Changeset 35623 in webkit


Ignore:
Timestamp:
Aug 7, 2008 5:09:19 AM (16 years ago)
Author:
jmalonzo@webkit.org
Message:

2008-08-07 Alp Toker <alp@nuanti.com>

Reviewed by Eric Seidel.

https://bugs.webkit.org/show_bug.cgi?id=20313
Add null check in String::fromUTF8()

Make String::fromUTF8() consistent with other constructors by
returning a null String when the input is null instead of crashing.

  • platform/text/String.cpp: (WebCore::String::fromUTF8):
Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r35618 r35623  
     12008-08-07  Alp Toker  <alp@nuanti.com>
     2
     3        Reviewed by Eric Seidel.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=20313
     6        Add null check in String::fromUTF8()
     7
     8        Make String::fromUTF8() consistent with other constructors by
     9        returning a null String when the input is null instead of crashing.
     10
     11        * platform/text/String.cpp:
     12        (WebCore::String::fromUTF8):
     13
    1142008-08-06  Kevin Ollivier  <kevino@theolliviers.com>
    215
  • trunk/WebCore/platform/text/String.cpp

    r34607 r35623  
    583583String String::fromUTF8(const char* string, size_t size)
    584584{
     585    if (!string)
     586        return String();
    585587    return UTF8Encoding().decode(string, size);
    586588}
     
    588590String String::fromUTF8(const char* string)
    589591{
     592    if (!string)
     593        return String();
    590594    return UTF8Encoding().decode(string, strlen(string));
    591595}
Note: See TracChangeset for help on using the changeset viewer.