This commit is contained in:
twinaphex 2020-02-23 06:34:41 +01:00
parent 0ec3a8a449
commit 3b207990ce
2 changed files with 9 additions and 29 deletions

View File

@ -143,13 +143,9 @@ bool disk_control_append_enabled(
bool disk_control_image_label_enabled( bool disk_control_image_label_enabled(
disk_control_interface_t *disk_control) disk_control_interface_t *disk_control)
{ {
if (!disk_control) if (!disk_control || !disk_control->cb.get_image_label)
return false; return false;
if (disk_control->cb.get_image_label)
return true; return true;
return false;
} }
/* Returns true if core supports setting /* Returns true if core supports setting
@ -177,12 +173,8 @@ bool disk_control_initial_image_enabled(
bool disk_control_get_eject_state( bool disk_control_get_eject_state(
disk_control_interface_t *disk_control) disk_control_interface_t *disk_control)
{ {
if (!disk_control) if (!disk_control || !disk_control->cb.get_eject_state)
return false; return false;
if (!disk_control->cb.get_eject_state)
return false;
return disk_control->cb.get_eject_state(); return disk_control->cb.get_eject_state();
} }
@ -191,12 +183,8 @@ bool disk_control_get_eject_state(
unsigned disk_control_get_num_images( unsigned disk_control_get_num_images(
disk_control_interface_t *disk_control) disk_control_interface_t *disk_control)
{ {
if (!disk_control) if (!disk_control || !disk_control->cb.get_num_images)
return 0; return 0;
if (!disk_control->cb.get_num_images)
return 0;
return disk_control->cb.get_num_images(); return disk_control->cb.get_num_images();
} }
@ -204,12 +192,8 @@ unsigned disk_control_get_num_images(
unsigned disk_control_get_image_index( unsigned disk_control_get_image_index(
disk_control_interface_t *disk_control) disk_control_interface_t *disk_control)
{ {
if (!disk_control) if (!disk_control || !disk_control->cb.get_image_index)
return 0; return 0;
if (!disk_control->cb.get_image_index)
return 0;
return disk_control->cb.get_image_index(); return disk_control->cb.get_image_index();
} }
@ -307,10 +291,7 @@ bool disk_control_set_eject_state(
msg[0] = '\0'; msg[0] = '\0';
if (!disk_control) if (!disk_control || !disk_control->cb.set_eject_state)
return false;
if (!disk_control->cb.set_eject_state)
return false; return false;
/* Set eject state */ /* Set eject state */

View File

@ -160,10 +160,9 @@ static bool disk_index_file_read(disk_index_file_t *disk_index_file)
if (!disk_index_file) if (!disk_index_file)
return false; return false;
if (string_is_empty(disk_index_file->file_path)) if ( string_is_empty(disk_index_file->file_path) ||
return false; !path_is_valid(disk_index_file->file_path)
)
if (!path_is_valid(disk_index_file->file_path))
return false; return false;
/* Attempt to open disk index file */ /* Attempt to open disk index file */