aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Nielsen <agenthh@gmail.com>2011-05-25 18:32:43 -0700
committerHans Nielsen <agenthh@gmail.com>2011-05-25 18:32:43 -0700
commitf328e7f8acccca78cd0e7559b6cbcd17d56844e6 (patch)
tree3ef1ed95b67dcf022657c79f910b4ba8b5df5898
parentf02c7ce04fda4d0397634ffd642122081295aed1 (diff)
downloadconnectbot-f328e7f8acccca78cd0e7559b6cbcd17d56844e6.tar.gz
connectbot-f328e7f8acccca78cd0e7559b6cbcd17d56844e6.tar.bz2
connectbot-f328e7f8acccca78cd0e7559b6cbcd17d56844e6.zip
Avoid null-pointer exception in ConnectionNotifier
-rw-r--r--src/org/connectbot/service/ConnectionNotifier.java36
1 files changed, 20 insertions, 16 deletions
diff --git a/src/org/connectbot/service/ConnectionNotifier.java b/src/org/connectbot/service/ConnectionNotifier.java
index ffe2230..d276761 100644
--- a/src/org/connectbot/service/ConnectionNotifier.java
+++ b/src/org/connectbot/service/ConnectionNotifier.java
@@ -147,26 +147,30 @@ public abstract class ConnectionNotifier {
@Override
public void showRunningNotification(Service context) {
- Object[] setForegroundArgs = new Object[1];
- setForegroundArgs[0] = Boolean.TRUE;
- try {
- setForeground.invoke(context, setForegroundArgs);
- } catch (InvocationTargetException e) {
- } catch (IllegalAccessException e) {
- }
- getNotificationManager(context).notify(ONLINE_NOTIFICATION, newRunningNotification(context));
+ if (setForeground != null) {
+ Object[] setForegroundArgs = new Object[1];
+ setForegroundArgs[0] = Boolean.TRUE;
+ try {
+ setForeground.invoke(context, setForegroundArgs);
+ } catch (InvocationTargetException e) {
+ } catch (IllegalAccessException e) {
+ }
+ getNotificationManager(context).notify(ONLINE_NOTIFICATION, newRunningNotification(context));
+ }
}
@Override
public void hideRunningNotification(Service context) {
- Object[] setForegroundArgs = new Object[1];
- setForegroundArgs[0] = Boolean.FALSE;
- try {
- setForeground.invoke(context, setForegroundArgs);
- } catch (InvocationTargetException e) {
- } catch (IllegalAccessException e) {
- }
- getNotificationManager(context).cancel(ONLINE_NOTIFICATION);
+ if (setForeground != null) {
+ Object[] setForegroundArgs = new Object[1];
+ setForegroundArgs[0] = Boolean.FALSE;
+ try {
+ setForeground.invoke(context, setForegroundArgs);
+ } catch (InvocationTargetException e) {
+ } catch (IllegalAccessException e) {
+ }
+ getNotificationManager(context).cancel(ONLINE_NOTIFICATION);
+ }
}
}