From 138393889ddb6c1c210af9339d1625d39dda18ee Mon Sep 17 00:00:00 2001 From: joonhaengHeo <85541460+joonhaengHeo@users.noreply.github.com> Date: Fri, 17 Feb 2023 22:17:12 +0900 Subject: [PATCH] Fix Android CHipTool QRCode scan crash issue (#25141) --- .../chip/chiptool/setuppayloadscanner/BarcodeFragment.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/setuppayloadscanner/BarcodeFragment.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/setuppayloadscanner/BarcodeFragment.kt index 8c5faed88e3601..ddc55ccd65179f 100644 --- a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/setuppayloadscanner/BarcodeFragment.kt +++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/setuppayloadscanner/BarcodeFragment.kt @@ -187,7 +187,7 @@ class BarcodeFragment : Fragment() { Log.e(TAG, "Unrecognized QR Code", ex) Toast.makeText(requireContext(), "Unrecognized QR Code", Toast.LENGTH_SHORT).show() } - FragmentUtil.getHost(this, Callback::class.java) + FragmentUtil.getHost(this@BarcodeFragment, Callback::class.java) ?.onCHIPDeviceInfoReceived(CHIPDeviceInfo.fromSetupPayload(payload)) } @@ -201,7 +201,7 @@ class BarcodeFragment : Fragment() { Toast.makeText(requireContext(), "Unrecognized QR Code", Toast.LENGTH_SHORT).show() return@post } - FragmentUtil.getHost(this, Callback::class.java) + FragmentUtil.getHost(this@BarcodeFragment, Callback::class.java) ?.onCHIPDeviceInfoReceived(CHIPDeviceInfo.fromSetupPayload(payload)) } }