From 3785fc45245bf0ee8d1caca72c15187898c4d084 Mon Sep 17 00:00:00 2001 From: Andre Leiradella Date: Wed, 8 Feb 2017 19:45:01 +0000 Subject: [PATCH] Fixed crash in cheevos_get_description --- cheevos/cheevos.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/cheevos/cheevos.c b/cheevos/cheevos.c index 39be2afb93..8469e4622c 100644 --- a/cheevos/cheevos.c +++ b/cheevos/cheevos.c @@ -3225,15 +3225,23 @@ void cheevos_populate_menu(void *data, bool hardcore) bool cheevos_get_description(cheevos_ctx_desc_t *desc) { - cheevo_t *cheevos = cheevos_locals.core.cheevos; - - if (desc->idx >= cheevos_locals.core.count) + if (cheevos_loaded) { - cheevos = cheevos_locals.unofficial.cheevos; - desc->idx -= cheevos_locals.unofficial.count; - } + cheevo_t *cheevos = cheevos_locals.core.cheevos; - strlcpy(desc->s, cheevos[desc->idx].description, desc->len); + if (desc->idx >= cheevos_locals.core.count) + { + cheevos = cheevos_locals.unofficial.cheevos; + desc->idx -= cheevos_locals.unofficial.count; + } + + strlcpy(desc->s, cheevos[desc->idx].description, desc->len); + } + else + { + *desc->s = 0; + } + return true; }