Add checks before return server name.
Try to avoid possible NPE. Change-Id: I7e89ac38251b0840c66e36f9e0284be2073424c3
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user