From e2f4752ab5f0e6dba96df8d7c35e102ded57c3f9 Mon Sep 17 00:00:00 2001 From: Pixel Date: Tue, 15 Nov 2011 20:57:27 -0800 Subject: Making the String class a bit more tolerent of NULL strings. --- includes/BString.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'includes/BString.h') diff --git a/includes/BString.h b/includes/BString.h index 794126f..89f1d9f 100644 --- a/includes/BString.h +++ b/includes/BString.h @@ -14,8 +14,8 @@ namespace Balau { class String : private std::string { public: String() : std::string() { } - String(const char * str) : std::string(str) { } - String(const char * str, size_t n) : std::string(str, n) { } + String(const char * str) : std::string(str ? str : "") { } + String(const char * str, size_t n) : std::string(str ? str : "", str ? n : 0) { } String(char c) { set("%c", c); } String(int32_t i) { set("%i", i); } String(uint32_t i) { set("%u", i); } -- cgit v1.2.3