From 629ae0b16e244deb3bd306459b7a1b6743ba4f36 Mon Sep 17 00:00:00 2001 From: Hocuri Date: Wed, 5 Nov 2025 17:26:32 +0100 Subject: [PATCH] fix: Don't crash when QR code can't be loaded (#3995) Before this PR, when a QR code couldn't be loaded because of https://github.com/chatmail/core/pull/7399, Delta Chat crashed. Now, the button does nothing. It's not perfect, but easy to do, and only about an edge case where the user tried out the experimental broadcast channels in the past, and now tries to add a new member to a broadcast channel created with an old version of DC. The hollistic alternative would be to switch to RPC for getSecurejoinQrSvg, so that the UI can get a proper error message. --------- Co-authored-by: adb --- .../java/org/thoughtcrime/securesms/qr/QrShowFragment.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/org/thoughtcrime/securesms/qr/QrShowFragment.java b/src/main/java/org/thoughtcrime/securesms/qr/QrShowFragment.java index 0b846319c..398277049 100644 --- a/src/main/java/org/thoughtcrime/securesms/qr/QrShowFragment.java +++ b/src/main/java/org/thoughtcrime/securesms/qr/QrShowFragment.java @@ -96,6 +96,12 @@ public class QrShowFragment extends Fragment implements DcEventCenter.DcEventDel imageView.setSVG(svg); } catch (SVGParseException e) { e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + Activity activity = getActivity(); + if (activity != null) { + activity.finish(); + } } view.findViewById(R.id.share_link_button).setOnClickListener((v) -> showInviteLinkDialog());