From b7aeb806ab4b9563a8cb28b6848c6ff0c0d02fb0 Mon Sep 17 00:00:00 2001 From: cold-brewed Date: Tue, 30 Aug 2022 19:35:44 -0400 Subject: [PATCH] Media history: Address potential null pointer when saving config --- src/config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config.c b/src/config.c index 45655c8a7..55dd5dff2 100644 --- a/src/config.c +++ b/src/config.c @@ -3149,7 +3149,7 @@ save_floppy_and_cdrom_drives(void) for (int i = 0; i < MAX_PREV_IMAGES; i++) { sprintf(temp, "cdrom_%02i_image_history_%02i", c + 1, i + 1); - if(strlen(cdrom[c].image_history[i]) == 0) { + if((cdrom[c].image_history[i] == 0) || strlen(cdrom[c].image_history[i]) == 0) { config_delete_var(cat, temp); } else { config_set_string(cat, temp, cdrom[c].image_history[i]);