From dbf9bd6616627ef25471d5052acd80a5ba78da4a Mon Sep 17 00:00:00 2001 From: Brandon Wright Date: Mon, 4 Jun 2018 10:36:55 -0500 Subject: [PATCH] Fix crash when elements are missing. --- cheats2.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cheats2.cpp b/cheats2.cpp index f457a8d44..b3c7eb08d 100644 --- a/cheats2.cpp +++ b/cheats2.cpp @@ -743,12 +743,14 @@ static void S9xLoadCheatsFromBMLNode (bml_node *n) bml_node *tmp = NULL; tmp = bml_find_sub(c, "name"); - desc = tmp->data; - if (!desc) + if (!tmp) desc = (char *) ""; + else + desc = tmp->data; tmp = bml_find_sub(c, "code"); - code = tmp->data; + if (tmp) + code = tmp->data; if (bml_find_sub(c, "enabled")) enabled = true;