From bb9e36f9c683ea888fd5c9ecde2f7c586a0238ac Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 22 May 2019 12:34:08 -0700 Subject: Fixed nasty null-string-int-conversion bug. --- src/stable/string.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/stable/string.cpp b/src/stable/string.cpp index 3029584..ed7be27 100644 --- a/src/stable/string.cpp +++ b/src/stable/string.cpp @@ -967,18 +967,24 @@ Bu::String Bu::String::toUpper() const int16_t Bu::String::toInt16( int iRadix ) const { flatten(); + if( core->pFirst == NULL || core->nLength == 0 ) + return 0; return strtol( core->pFirst->pData, NULL, iRadix ); } int32_t Bu::String::toInt32( int iRadix ) const { flatten(); + if( core->pFirst == NULL || core->nLength == 0 ) + return 0; return strtol( core->pFirst->pData, NULL, iRadix ); } int64_t Bu::String::toInt64( int iRadix ) const { flatten(); + if( core->pFirst == NULL || core->nLength == 0 ) + return 0; return strtoll( core->pFirst->pData, NULL, iRadix ); } -- cgit v1.2.3