Fix critical warning when conversation web view load request URI is null.

* src/client/conversation-viewer/conversation-web-view.vala
  (ConversationWebView::on_resource_request_starting): Check that the URI
  is not null before using it.
  (ConversationWebView::is_always_loaded): Remove null check and don't
  allow the param to be null, since all uses now pass in a non-null
  param.
This commit is contained in:
Michael James Gratton 2016-08-04 10:51:15 +10:00
parent 05cfb77dca
commit 9c31401606

View file

@ -99,18 +99,15 @@ public class ConversationWebView : StylishWebView {
}
string? uri = request.get_uri();
if (!is_always_loaded(uri)) {
if (uri != null && !is_always_loaded(uri)) {
if (uri.has_prefix(allow_prefix))
request.set_uri(uri.substring(allow_prefix.length));
else
request.set_uri("about:blank");
}
}
public bool is_always_loaded(string? uri) {
if (uri == null)
return true;
public bool is_always_loaded(string uri) {
foreach (string prefix in always_loaded_prefixes) {
if (uri.has_prefix(prefix))
return true;