summaryrefslogtreecommitdiffstats
path: root/Source/WebKit2/Shared/API/c/cf/WKURLResponseCF.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit2/Shared/API/c/cf/WKURLResponseCF.cpp')
-rw-r--r--Source/WebKit2/Shared/API/c/cf/WKURLResponseCF.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/Source/WebKit2/Shared/API/c/cf/WKURLResponseCF.cpp b/Source/WebKit2/Shared/API/c/cf/WKURLResponseCF.cpp
index 42473c8..10b4941 100644
--- a/Source/WebKit2/Shared/API/c/cf/WKURLResponseCF.cpp
+++ b/Source/WebKit2/Shared/API/c/cf/WKURLResponseCF.cpp
@@ -33,6 +33,9 @@ using namespace WebKit;
WKURLResponseRef WKURLResponseCreateWithCFURLResponse(CFURLResponseRef urlResponse)
{
+ if (!urlResponse)
+ return 0;
+
CFURLResponseRef copiedURLResponse = CFURLResponseCreateCopy(kCFAllocatorDefault, urlResponse);
RefPtr<WebURLResponse> response = WebURLResponse::create(copiedURLResponse);
return toAPI(response.release().releaseRef());
@@ -40,5 +43,12 @@ WKURLResponseRef WKURLResponseCreateWithCFURLResponse(CFURLResponseRef urlRespon
CFURLResponseRef WKURLResponseCopyCFURLResponse(CFAllocatorRef alloc, WKURLResponseRef urlResponse)
{
+ if (!urlResponse)
+ return 0;
+
+ PlatformResponse platformURLResponse = toImpl(urlResponse)->platformResponse();
+ if (!platformURLResponse)
+ return 0;
+
return CFURLResponseCreateCopy(alloc, toImpl(urlResponse)->platformResponse());
}