From 2d35b0471359c61489836f8391f53b7ab59fb906 Mon Sep 17 00:00:00 2001 From: Albert Vaca Date: Tue, 16 May 2017 21:01:34 +0200 Subject: [PATCH] Fix IllegalStateException: Fragment not attached to Activity BUG: 379873 --- src/org/kde/kdeconnect/UserInterface/PairingFragment.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/org/kde/kdeconnect/UserInterface/PairingFragment.java b/src/org/kde/kdeconnect/UserInterface/PairingFragment.java index c5fe6225..b848baf7 100644 --- a/src/org/kde/kdeconnect/UserInterface/PairingFragment.java +++ b/src/org/kde/kdeconnect/UserInterface/PairingFragment.java @@ -99,6 +99,11 @@ public class PairingFragment extends Fragment implements PairingDeviceItem.Callb @Override public void run() { + if (!isAdded()) { + //Fragment is not attached to an activity. We will crash if we try to do anything here. + return; + } + if (listRefreshCalledThisFrame) { // This makes sure we don't try to call list.getFirstVisiblePosition() // twice per frame, because the second time the list hasn't been drawn