Commit 4ae4e639 authored by Philip Withnall's avatar Philip Withnall
Browse files

Bug 664072 — Folks should only use assert*() for critical, program-terminating errors

Turn various assert()s into return[_val]_if_fail()s.

Closes: https://bugzilla.gnome.org/show_bug.cgi?id=664072
parent 0f8f332d
......@@ -5,6 +5,8 @@ Bugs fixed:
• Bug 681346 — Individual id can be inconsistent
• Bug 681420 — warning (vala 0.17.x): access to static class members through an
instance variable
• Bug 664072 — Folks should only use assert*() for critical, program-terminating
errors
Overview of changes from libfolks 0.7.2 to libfolks 0.7.3
=========================================================
......
......@@ -1554,7 +1554,8 @@ public class Tpf.PersonaStore : Folks.PersonaStore
}
/* Bail if a store already exists for this account. */
assert (!PersonaStore._persona_stores_by_account.has_key (store.id));
return_if_fail (
!PersonaStore._persona_stores_by_account.has_key (store.id));
/* Add the store. */
PersonaStore._persona_stores_by_account.set (store.id, store);
......
......@@ -1258,8 +1258,8 @@ public class Folks.Individual : Object,
{
CompareDataFunc<Persona> primary_compare_func = (a, b) =>
{
assert (a != null);
assert (b != null);
return_val_if_fail (a != null, 0);
return_val_if_fail (b != null, 0);
/* Always prefer values which are set over those which aren't. */
var a_is_set = filter_func (a);
......@@ -1446,7 +1446,7 @@ public class Folks.Individual : Object,
this._update_single_valued_property (typeof (AliasDetails), (p) =>
{
var alias = ((AliasDetails) p).alias;
assert (alias != null);
return_val_if_fail (alias != null, false);
return (alias.strip () != ""); /* empty aliases are unset */
}, (a, b) =>
......@@ -1454,8 +1454,8 @@ public class Folks.Individual : Object,
var a_alias = ((AliasDetails) a).alias;
var b_alias = ((AliasDetails) b).alias;
assert (a_alias != null);
assert (b_alias != null);
return_val_if_fail (a_alias != null, 0);
return_val_if_fail (b_alias != null, 0);
var a_is_empty = (a_alias.strip () == "") ? 1 : 0;
var b_is_empty = (b_alias.strip () == "") ? 1 : 0;
......@@ -1670,7 +1670,7 @@ public class Folks.Individual : Object,
this._update_single_valued_property (typeof (NameDetails), (p) =>
{
var name = ((NameDetails) p).full_name;
assert (name != null);
return_val_if_fail (name != null, false);
return (name.strip () != ""); /* empty names are unset */
}, (a, b) =>
......@@ -1699,7 +1699,7 @@ public class Folks.Individual : Object,
this._update_single_valued_property (typeof (NameDetails), (p) =>
{
var nickname = ((NameDetails) p).nickname;
assert (nickname != null);
return_val_if_fail (nickname != null, false);
return (nickname.strip () != ""); /* empty names are unset */
}, (a, b) =>
......
......@@ -473,8 +473,8 @@ public class Folks.PotentialMatch : Object
return false;
}
assert (a.validate ());
assert (b.validate ());
return_val_if_fail (a.validate (), false);
return_val_if_fail (b.validate (), false);
var a_stripped = this._strip_string ((!) a);
var b_stripped = this._strip_string ((!) b);
......@@ -499,8 +499,8 @@ public class Folks.PotentialMatch : Object
return false;
}
assert (a.validate ());
assert (b.validate ());
return_val_if_fail (a.validate (), false);
return_val_if_fail (b.validate (), false);
var a_stripped = this._strip_string ((!) a);
var b_stripped = this._strip_string ((!) b);
......
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