Commit c3ace8c0 authored by Philip Withnall's avatar Philip Withnall
Browse files

individual: Allow Individual.id to be an empty string with no personas

If an Individual has no Personas (as can happen when it’s just been
constructed), document the ID as being the empty string. This is a
special case.

Previously, the ID defaulted to being null, which violated its specified
type.

https://bugzilla.gnome.org/show_bug.cgi?id=648811
parent 1cff44ab
......@@ -286,8 +286,11 @@ public class Folks.Individual : Object,
* instead. For example, if storing references to Individuals who are tagged
* in a photo, it may be safer to store the UID of the Persona whose backend
* provided the photo (e.g. Facebook).
*
* As a special case, the ID defaults to an empty string when the individual
* has no personas (i.e. if it’s just been constructed).
*/
public string id { get; private set; }
public string id { get; private set; default = ""; }
/**
* Emitted when the last of the Individual's {@link Persona}s has been
......@@ -2899,6 +2902,11 @@ public class Folks.Individual : Object,
this.id = Checksum.compute_for_string (ChecksumType.SHA1,
((!) chosen_persona).uid);
}
else
{
/* Default if we have no personas. */
this.id = "";
}
/* Update our aggregated fields and notify the changes */
this._update_fields ();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment