Don’t use the fingerprint of a field that has a null value.
[Sone.git] / src / main / java / net / pterodactylus / sone / data / Profile.java
index d091b89..2b6991a 100644 (file)
@@ -258,15 +258,8 @@ public class Profile implements Fingerprintable {
                fields.add(min(fieldIndex + 1, fields.size()), field);
        }
 
-       /**
-        * Removes the given field.
-        *
-        * @param field
-        *            The field to remove
-        */
        public void removeField(Field field) {
                checkNotNull(field, "field must not be null");
-               checkArgument(hasField(field), "field must belong to this profile");
                fields.remove(field);
        }
 
@@ -370,7 +363,9 @@ public class Profile implements Fingerprintable {
                }
                hash.putString("ContactInformation(");
                for (Field field : fields) {
-                       hash.putString(field.getName()).putString("(").putString(field.getValue()).putString(")");
+                       if (field.getValue() != null) {
+                               hash.putString(field.getName()).putString("(").putString(field.getValue()).putString(")");
+                       }
                }
                hash.putString(")");
                hash.putString(")");