From 3368390f37c695879f06e89d9ceae8ee275cdc56 Mon Sep 17 00:00:00 2001 From: Kp Date: Thu, 15 Jan 2015 04:30:03 +0000 Subject: [PATCH] Check for valid SuperX number --- d1x-rebirth/main/bmread.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/d1x-rebirth/main/bmread.cpp b/d1x-rebirth/main/bmread.cpp index c1eb36e3b..219b72866 100644 --- a/d1x-rebirth/main/bmread.cpp +++ b/d1x-rebirth/main/bmread.cpp @@ -387,7 +387,7 @@ int gamedata_read_tbl(int pc_shareware) PHYSFSX_gets_line_t inputline; while (PHYSFSX_fgets(inputline, InfoFile)) { int l; - char *temp_ptr; + const char *temp_ptr; int skip; linenum++; @@ -414,7 +414,10 @@ int gamedata_read_tbl(int pc_shareware) SuperX = -1; if ( (temp_ptr=strstr( inputline, "superx=" )) ) { - SuperX = atoi( &temp_ptr[7] ); + char *p; + auto s = strtol(&temp_ptr[7], &p, 10); + if (!*p) + SuperX = s; } char *arg = strtok( inputline, space );