Add checks before return server name.

Try to avoid possible NPE.

Change-Id: I7e89ac38251b0840c66e36f9e0284be2073424c3
This commit is contained in:
Artur Dryomov
2013-09-13 18:34:30 +03:00
parent 6f5094515d
commit 8fe5b47826

View File

@@ -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;
}