From 34cbe3277346550d1b475e8f9cc632e0a0fe0721 Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine" Date: Wed, 23 Jun 2010 17:06:42 +0000 Subject: Added null pointer assertions to as_utf8 and as_wide git-svn-id: http://pugixml.googlecode.com/svn/trunk@531 99668b35-9821-0410-8761-19e4c4f06640 --- src/pugixml.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pugixml.cpp b/src/pugixml.cpp index c17047c..e6b24e2 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -4459,6 +4459,8 @@ namespace pugi #ifndef PUGIXML_NO_STL std::string PUGIXML_FUNCTION as_utf8(const wchar_t* str) { + assert(str); + STATIC_ASSERT(sizeof(wchar_t) == 2 || sizeof(wchar_t) == 4); size_t length = wcslen(str); @@ -4495,6 +4497,8 @@ namespace pugi std::wstring PUGIXML_FUNCTION as_wide(const char* str) { + assert(str); + const uint8_t* data = reinterpret_cast(str); size_t size = strlen(str); -- cgit v1.2.3