diff options
Diffstat (limited to 'src/de/blinkt/openvpn/fragments')
-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 |