diff options
Diffstat (limited to 'directory/src')
-rw-r--r-- | directory/src/main/java/com/orbekk/same/directory/NetworkEntry.java | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/directory/src/main/java/com/orbekk/same/directory/NetworkEntry.java b/directory/src/main/java/com/orbekk/same/directory/NetworkEntry.java index cac21cc..8f06cce 100644 --- a/directory/src/main/java/com/orbekk/same/directory/NetworkEntry.java +++ b/directory/src/main/java/com/orbekk/same/directory/NetworkEntry.java @@ -21,10 +21,18 @@ public class NetworkEntry { @Override public boolean equals(Object other) { if (other instanceof NetworkEntry) { - NetworkEntry otherEntry = (NetworkEntry)other; - return networkName.equals(otherEntry.networkName) && - masterUrl.equals(otherEntry.masterUrl); + NetworkEntry o = (NetworkEntry)other; + return stringEquals(networkName, o.networkName) && + stringEquals(masterUrl, o.masterUrl); } return false; } + + private boolean stringEquals(String s1, String s2) { + if (s1 == null) { + return s2 == null; + } else { + return s1.equals(s2); + } + } } |