diff options
author | Artur Dryomov <artur.dryomov@gmail.com> | 2013-09-13 18:34:30 +0300 |
---|---|---|
committer | Artur Dryomov <artur.dryomov@gmail.com> | 2013-09-14 01:25:32 +0300 |
commit | 8fe5b478267fc5d72ccdf6b6e1563be1cacc7ac3 (patch) | |
tree | 41ccc1315e48bb06b14d0c1feaeb8f336eaf7c71 | |
parent | 6f5094515dac8e8cfc90050e0691ad361acb0157 (diff) |
Add checks before return server name.
Try to avoid possible NPE.
Change-Id: I7e89ac38251b0840c66e36f9e0284be2073424c3
-rw-r--r-- | android/sdremote/src/org/libreoffice/impressremote/communication/Server.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/Server.java b/android/sdremote/src/org/libreoffice/impressremote/communication/Server.java index 9f1a16b37812..de5c41d47676 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/communication/Server.java +++ b/android/sdremote/src/org/libreoffice/impressremote/communication/Server.java @@ -10,6 +10,7 @@ package org.libreoffice.impressremote.communication; import android.os.Parcel; import android.os.Parcelable; +import android.text.TextUtils; public class Server implements Parcelable { private static final int SPECIAL_PARCELABLE_OBJECTS_BITMASK = 0; @@ -45,6 +46,14 @@ public class Server implements Parcelable { } public String getName() { + if (mName == null) { + return mAddress; + } + + if (TextUtils.isEmpty(mName)) { + return mAddress; + } + return mName; } |