From b148bcce05254c7ebe0ad855e5f1e958968a0bb9 Mon Sep 17 00:00:00 2001 From: neonloop Date: Wed, 4 Aug 2021 22:40:32 +0000 Subject: Only wrap option info if it exists --- options.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'options.c') diff --git a/options.c b/options.c index 2bac4b1..5d1b5d3 100644 --- a/options.c +++ b/options.c @@ -105,15 +105,17 @@ void options_init(const struct retro_core_option_definition *defs) { strncpy(entry->desc, entry->def->desc, len); truncate(entry->desc, MAX_DESC_LEN); - len = strlen(entry->def->info) + 1; - entry->info = (char *)calloc(len, sizeof(char)); - if (!entry->info) { - PA_ERROR("Error allocating description string\n"); - options_free(); - return; + if (entry->def->info) { + len = strlen(entry->def->info) + 1; + entry->info = (char *)calloc(len, sizeof(char)); + if (!entry->info) { + PA_ERROR("Error allocating description string\n"); + options_free(); + return; + } + strncpy(entry->info, entry->def->info, len); + wrap(entry->info, MAX_LINE_LEN, MAX_LINES); } - strncpy(entry->info, entry->def->info, len); - wrap(entry->info, MAX_LINE_LEN, MAX_LINES); for (j = 0; entry->def->values[j].value; j++) ; -- cgit v1.2.3