diff options
author | Arne Schwabe <arne@rfc2549.org> | 2013-11-26 10:52:34 +0100 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2013-11-26 10:52:34 +0100 |
commit | 8a69788d1ba7aa0cf9fd76a5af41b0bb1ed53fcf (patch) | |
tree | 7bf2ba890f993a0127d0b5ee164cdecfddb5747a /src/de/blinkt/openvpn | |
parent | 55183b176a1bbbbd2f936934781c31314b280068 (diff) |
Fix not attached exception
Diffstat (limited to 'src/de/blinkt/openvpn')
-rw-r--r-- | src/de/blinkt/openvpn/fragments/LogFragment.java | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/src/de/blinkt/openvpn/fragments/LogFragment.java b/src/de/blinkt/openvpn/fragments/LogFragment.java index 40f9dfb6..a03d5160 100644 --- a/src/de/blinkt/openvpn/fragments/LogFragment.java +++ b/src/de/blinkt/openvpn/fragments/LogFragment.java @@ -602,25 +602,26 @@ public class LogFragment extends ListFragment implements StateListener, SeekBar. @Override - public void updateState(final String status,final String logMessage, final int resId, final ConnectionStatus level) { - getActivity().runOnUiThread(new Runnable() { - - @Override - public void run() { - String prefix = getString(resId) + ":"; - if (status.equals("BYTECOUNT") || status.equals("NOPROCESS")) - prefix = ""; - if (resId == R.string.unknown_state) - prefix += status; - if (mSpeedView != null) - mSpeedView.setText(prefix + logMessage); - - if (mConnectStatus != null) - mConnectStatus.setText(getString(resId)); - } - }); - - } + public void updateState(final String status, final String logMessage, final int resId, final ConnectionStatus level) { + if (isAdded()) { + getActivity().runOnUiThread(new Runnable() { + + @Override + public void run() { + String prefix = getString(resId) + ":"; + if (status.equals("BYTECOUNT") || status.equals("NOPROCESS")) + prefix = ""; + if (resId == R.string.unknown_state) + prefix += status; + if (mSpeedView != null) + mSpeedView.setText(prefix + logMessage); + + if (mConnectStatus != null) + mConnectStatus.setText(getString(resId)); + } + }); + } + } @Override |