Skip to content

Commit 4b4d5b1

Browse files
authored
checking for nil before loading file or request into webview (#437)
1 parent aa4975c commit 4b4d5b1

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Leanplum-SDK/Classes/MessageTemplates/ViewControllers/LPWebInterstitialViewController.m

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,23 @@ - (void)loadTemplate
134134
NSString *path = [LPFileManager documentsPath];
135135
NSURL* baseURL = [NSURL fileURLWithPath:path isDirectory:YES];
136136

137+
if (htmlURL == nil || baseURL == nil) {
138+
[self dismiss:NO];
139+
return;
140+
}
141+
137142
[self.webView loadFileURL:htmlURL allowingReadAccessToURL:baseURL];
138143
}
139144

140145
- (void)loadURL
141146
{
142147
NSString *url = [self.context stringNamed:LPMT_ARG_URL];
148+
149+
if (url == nil) {
150+
[self dismiss:NO];
151+
return;
152+
}
153+
143154
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]];
144155
[self.webView loadRequest:request];
145156
}

0 commit comments

Comments
 (0)