From 7e0d06b47b5b7f02ba6ea504c9144de5cf850b73 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 11 Jul 2014 19:57:01 -0400 Subject: [PATCH] frontend/history.c: Prevent possible null dereference of hist --- frontend/menu/history.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/frontend/menu/history.c b/frontend/menu/history.c index a52eea856e..123ff2e693 100644 --- a/frontend/menu/history.c +++ b/frontend/menu/history.c @@ -111,8 +111,14 @@ void rom_history_push(rom_history_t *hist, static void rom_history_write_file(rom_history_t *hist) { size_t i; - FILE *file = fopen(hist->conf_path, "w"); - if (!file || !hist) + FILE *file = NULL; + + if (!hist) + return; + + file = fopen(hist->conf_path, "w"); + + if (!file) return; for (i = 0; i < hist->size; i++)