Skip to content

Commit f660c93

Browse files
dtrainorCommit bot
authored andcommitted
[Android] Handle a null java side of CVC in context menu
We might have a native ContentViewCore but not a java side. Don't attempt to show the context menu if this is the case. BUG=410599 Review URL: https://codereview.chromium.org/610913004 Cr-Commit-Position: refs/heads/master@{#297318}
1 parent af0ddd5 commit f660c93

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

chrome/browser/ui/android/context_menu_helper.cc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,18 @@ void ContextMenuHelper::ShowContextMenu(
4141
if (!content_view_core)
4242
return;
4343

44+
base::android::ScopedJavaLocalRef<jobject> jcontent_view_core(
45+
content_view_core->GetJavaObject());
46+
47+
if (jcontent_view_core.is_null())
48+
return;
49+
4450
JNIEnv* env = base::android::AttachCurrentThread();
4551
context_menu_params_ = params;
4652
Java_ContextMenuHelper_showContextMenu(
4753
env,
4854
java_obj_.obj(),
49-
content_view_core->GetJavaObject().obj(),
55+
jcontent_view_core.obj(),
5056
ContextMenuHelper::CreateJavaContextMenuParams(params).obj());
5157
}
5258

0 commit comments

Comments
 (0)