- avoid crashes when rom path and vga rom path are null

This commit is contained in:
Bryce Denney 2001-06-09 21:19:58 +00:00
parent af53a1158e
commit 8e7c2e42f3
2 changed files with 23 additions and 9 deletions

View File

@ -1,6 +1,6 @@
/*
* gui/control.cc
* $Id: control.cc,v 1.4 2001-06-09 21:12:16 bdenney Exp $
* $Id: control.cc,v 1.5 2001-06-09 21:19:58 bdenney Exp $
*
* This is code for a text-mode control panel. Note that this file
* does NOT include bochs.h. Instead, it does all of its contact with
@ -270,10 +270,10 @@ static char *startup_interface_options =
Bochs Interface Options\n\
------------------\n\
0. Return to previous menu\n\
1. VGA Update Interval: 300000\n\
2. Mouse: enabled\n\
3. Emulated instructions per second (IPS): 1000000\n\
4. Private Colormap: enabled=0\n\
1. VGA Update Interval: %d\n\
2. Mouse: %s\n\
3. Emulated instructions per second (IPS): %d\n\
4. Private Colormap: %s\n\
\n\
Please choose one: [0] ";
@ -476,9 +476,16 @@ int bx_control_panel (int menu)
}
}
break;
case BX_CPANEL_START_OPTS_DISK:
#if 0
case BX_CPANEL_START_OPTS_INTERFACE:
{
char prompt[1024];
int interval;
SIM->get_vga_update_interval (&interval);
sprintf (prompt, startup_interface_options,
interval,
SIM->get_mouse_enabled (),
SIM->getips ());
build_disk_options_prompt (startup_disk_options_prompt, prompt, 1024);
if (ask_int (prompt, 0, 7, 0, &choice) < 0) return -1;
switch (choice) {
@ -494,6 +501,7 @@ int bx_control_panel (int menu)
}
}
break;
#endif
case BX_CPANEL_RUNTIME:
if (ask_int (runtime_menu_prompt, 1, 9, 8, &choice) < 0) return -1;
switch (choice) {

View File

@ -1,6 +1,6 @@
/*
* gui/siminterface.cc
* $Id: siminterface.cc,v 1.5 2001-06-09 21:12:16 bdenney Exp $
* $Id: siminterface.cc,v 1.6 2001-06-09 21:19:58 bdenney Exp $
*
* Defines the actual link between bx_simulator_interface_c methods
* and the simulator. This file includes bochs.h because it needs
@ -296,7 +296,10 @@ bx_real_sim_c::set_mem_size (int megs) {
int
bx_real_sim_c::get_rom_path (char *buf, int len)
{
strncpy (buf, bx_options.rom.path, len);
if (bx_options.rom.path)
strncpy (buf, bx_options.rom.path, len);
else
buf[0] = 0;
return 0;
}
@ -310,7 +313,10 @@ bx_real_sim_c::set_rom_path (char *path)
int
bx_real_sim_c::get_vga_path (char *buf, int len)
{
strncpy (buf, bx_options.vgarom.path, len);
if (bx_options.vgarom.path)
strncpy (buf, bx_options.vgarom.path, len);
else
buf[0] = 0;
return 0;
}