Add validation.
[Sone.git] / src / main / java / net / pterodactylus / sone / core / Core.java
index 7545d98..5a91f79 100644 (file)
@@ -525,6 +525,7 @@ public class Core implements IdentityListener, UpdateListener {
         * @return {@code true} if the target Sone is trusted by the origin Sone
         */
        public boolean isSoneTrusted(Sone origin, Sone target) {
+               Validation.begin().isNotNull("Origin", origin).isNotNull("Target", target).check().isInstanceOf("Origin’s OwnIdentity", origin.getIdentity(), OwnIdentity.class).check();
                return trustedIdentities.containsKey(origin.getIdentity()) && trustedIdentities.get(origin.getIdentity()).contains(target.getIdentity());
        }