Add checks to CefStringBase constructors for NULL pointers (issue #671).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@733 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2012-08-07 17:05:42 +00:00
parent b6720c17e0
commit ba1dc0fe45
1 changed files with 8 additions and 4 deletions

View File

@ -314,7 +314,8 @@ class CefStringBase {
}
CefStringBase(const char* src) // NOLINT(runtime/explicit)
: string_(NULL), owner_(false) {
FromString(std::string(src));
if (src)
FromString(std::string(src));
}
///
@ -328,7 +329,8 @@ class CefStringBase {
}
CefStringBase(const wchar_t* src) // NOLINT(runtime/explicit)
: string_(NULL), owner_(false) {
FromWString(std::wstring(src));
if (src)
FromWString(std::wstring(src));
}
#if (defined(BUILDING_CEF_SHARED) && defined(WCHAR_T_IS_UTF32))
@ -343,7 +345,8 @@ class CefStringBase {
}
CefStringBase(const char16* src) // NOLINT(runtime/explicit)
: string_(NULL), owner_(false) {
FromString16(string16(src));
if (src)
FromString16(string16(src));
}
#endif // BUILDING_CEF_SHARED && WCHAR_T_IS_UTF32
@ -355,7 +358,8 @@ class CefStringBase {
///
CefStringBase(const char_type* src, size_t src_len, bool copy)
: string_(NULL), owner_(false) {
FromString(src, src_len, copy);
if (src && src_len > 0)
FromString(src, src_len, copy);
}
///