فهرست منبع

fixed equals methods, Coverity issues 72280, 72281, 72283, 72284

Sebastian Stenzel 9 سال پیش
والد
کامیت
3a725e4a16

+ 2 - 2
main/filesystem-crypto/src/main/java/org/cryptomator/filesystem/crypto/CryptoNode.java

@@ -104,8 +104,8 @@ abstract class CryptoNode implements Node {
 		if (obj instanceof CryptoNode) {
 			CryptoNode other = (CryptoNode) obj;
 			return this.getClass() == other.getClass() //
-					&& (this.parent == null && other.parent == null || this.parent.equals(other.parent)) //
-					&& (this.name == null && other.name == null || this.name.equals(other.name));
+					&& (this.parent == null && other.parent == null || this.parent != null && this.parent.equals(other.parent)) //
+					&& (this.name == null && other.name == null || this.name != null && this.name.equals(other.name));
 		} else {
 			return false;
 		}

+ 2 - 2
main/filesystem-inmemory/src/main/java/org/cryptomator/filesystem/inmem/InMemoryNode.java

@@ -86,8 +86,8 @@ abstract class InMemoryNode implements Node {
 		if (obj instanceof InMemoryNode) {
 			InMemoryNode other = (InMemoryNode) obj;
 			return this.getClass() == other.getClass() //
-					&& (this.parent == null && other.parent == null || this.parent.equals(other.parent)) //
-					&& (this.name == null && other.name == null || this.name.equals(other.name));
+					&& (this.parent == null && other.parent == null || this.parent != null && this.parent.equals(other.parent)) //
+					&& (this.name == null && other.name == null || this.name != null && this.name.equals(other.name));
 		} else {
 			return false;
 		}