From 64db4c237962df0e7227723bc0d14a650ed56c25 Mon Sep 17 00:00:00 2001 From: castano Date: Fri, 3 Jul 2009 00:07:10 +0000 Subject: [PATCH] Fix assertion. Fixes issue 99. --- src/nvcore/StrLib.h | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/nvcore/StrLib.h b/src/nvcore/StrLib.h index 6b00b8a..fa0f604 100644 --- a/src/nvcore/StrLib.h +++ b/src/nvcore/StrLib.h @@ -182,7 +182,6 @@ namespace nv /// Dtor. ~String() { - nvDebugCheck(data != NULL); release(); } @@ -219,38 +218,44 @@ namespace nv /// Equal operator. bool operator==( const String & str ) const { - nvDebugCheck(data != NULL); - nvDebugCheck(str.data != NULL); if( str.data == data ) { return true; } + if ((data == NULL) != (str.data == NULL)) { + return false; + } return strcmp(data, str.data) == 0; } /// Equal operator. bool operator==( const char * str ) const { - nvDebugCheck(data != NULL); nvCheck(str != NULL); // Use isNull! + if (data == NULL) { + return false; + } return strcmp(data, str) == 0; } /// Not equal operator. bool operator!=( const String & str ) const { - nvDebugCheck(data != NULL); - nvDebugCheck(str.data != NULL); if( str.data == data ) { return false; } + if ((data == NULL) != (str.data == NULL)) { + return true; + } return strcmp(data, str.data) != 0; } /// Not equal operator. bool operator!=( const char * str ) const { - nvDebugCheck(data != NULL); nvCheck(str != NULL); // Use isNull! + if (data == NULL) { + return false; + } return strcmp(data, str) != 0; }