From c885c95ee0109dc541bffa5dbe765085e5ede1bb Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 9 Apr 2004 21:18:26 +0000 Subject: [PATCH] handle weird cases where 0 is listed in /proc/n/maps --- stepmania/src/archutils/Unix/Backtrace.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/stepmania/src/archutils/Unix/Backtrace.cpp b/stepmania/src/archutils/Unix/Backtrace.cpp index 64db2e1d9a..1dea9fdf1e 100644 --- a/stepmania/src/archutils/Unix/Backtrace.cpp +++ b/stepmania/src/archutils/Unix/Backtrace.cpp @@ -115,8 +115,15 @@ static int get_readable_ranges( const void **starts, const void **ends, int size if( strlen(space) < 4 || space[3] != 'x' ) continue; - *starts++ = (const void *) xtoi( line ); - *ends++ = (const void *) xtoi( hyphen+1 ); + /* If, for some reason, either end is NULL, skip it; that's our terminator. */ + const void *start = (const void *) xtoi( line ); + const void *end = (const void *) xtoi( hyphen+1 ); + if( start != NULL && end != NULL ) + { + *starts++ = start; + *ends++ = end; + } + ++got; }