summaryrefslogtreecommitdiff
path: root/Tools/TestWebKitAPI/mac/PlatformUtilitiesMac.mm
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/TestWebKitAPI/mac/PlatformUtilitiesMac.mm')
-rw-r--r--Tools/TestWebKitAPI/mac/PlatformUtilitiesMac.mm5
1 files changed, 4 insertions, 1 deletions
diff --git a/Tools/TestWebKitAPI/mac/PlatformUtilitiesMac.mm b/Tools/TestWebKitAPI/mac/PlatformUtilitiesMac.mm
index afa28a76a..1e73adbb3 100644
--- a/Tools/TestWebKitAPI/mac/PlatformUtilitiesMac.mm
+++ b/Tools/TestWebKitAPI/mac/PlatformUtilitiesMac.mm
@@ -67,7 +67,7 @@ WKURLRef URLForNonExistentResource()
WKRetainPtr<WKStringRef> MIMETypeForWKURLResponse(WKURLResponseRef wkResponse)
{
- RetainPtr<NSURLResponse> response(AdoptNS, WKURLResponseCopyNSURLResponse(wkResponse));
+ RetainPtr<NSURLResponse> response = adoptNS(WKURLResponseCopyNSURLResponse(wkResponse));
return adoptWK(WKStringCreateWithCFString((CFStringRef)[response.get() MIMEType]));
}
@@ -78,6 +78,9 @@ bool isKeyDown(WKNativeEventPtr event)
std::string toSTD(NSString *string)
{
+ if (!string)
+ return std::string();
+
size_t bufferSize = [string lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
OwnArrayPtr<char> buffer = adoptArrayPtr(new char[bufferSize]);
NSUInteger stringLength;