Skip to content

Commit 891cfc9

Browse files
committed
fail fast condition
1 parent 3ae6b1d commit 891cfc9

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

common/src/main/java/com/microsoft/identity/common/internal/providers/oauth2/WebViewAuthorizationFragment.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,10 @@ public boolean onCreateWindow(final WebView view, boolean isDialog,
400400
// Flight is off; should not reach here, but guard anyway.
401401
return false;
402402
}
403+
if (resultMsg.obj == null) {
404+
Logger.error(methodTag, "onCreateWindow: resultMsg.obj is null, cannot set up transport.", null);
405+
return false;
406+
}
403407
// Handles target="_blank" links by opening them in the device's default browser
404408
// instead of silently dropping the navigation.
405409
final SpanContext parentSpanContext = requireActivity() instanceof AuthorizationActivity
@@ -432,11 +436,6 @@ public boolean shouldOverrideUrlLoading(WebView v, WebResourceRequest request) {
432436
return true;
433437
}
434438
});
435-
if (resultMsg.obj == null) {
436-
Logger.error(methodTag, "onCreateWindow: resultMsg.obj is null, cannot set up transport.", null);
437-
span.setStatus(StatusCode.ERROR, "resultMsg.obj is null");
438-
return false;
439-
}
440439
final WebView.WebViewTransport transport = (WebView.WebViewTransport) resultMsg.obj;
441440
transport.setWebView(interceptorWebView);
442441
resultMsg.sendToTarget();

0 commit comments

Comments
 (0)