From 71cd552798123fc6b600b4d727ca245b4d62893c Mon Sep 17 00:00:00 2001 From: lado Date: Sun, 22 Jan 2012 02:53:22 +0100 Subject: npe fix --- vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'vdrmanager/src/de/bjusystems') diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java index 48b3389..7998936 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java @@ -97,11 +97,21 @@ public class Utils { && now < event.getStop().getTime(); } + private static String trimToEmpty(String str){ + if(str == null){ + return ""; + } + if(TextUtils.isEmpty(str)){ + return ""; + } + return str; + } + private static String getBaseUrl() { StringBuilder sb = new StringBuilder(); Preferences p = Preferences.getPreferences(); - String auth = p.getStreamingUsername().trim() + ":" - + p.getStreamingPassword(); + String auth = trimToEmpty(p.getStreamingUsername()) + ":" + + trimToEmpty(p.getStreamingPassword()); if (auth.length() == 1) { auth = ""; } else { -- cgit v1.2.3