[gnome-credentials] secret: Don't assume schema attributes are always present
- From: Daiki Ueno <dueno src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-credentials] secret: Don't assume schema attributes are always present
- Date: Mon, 22 May 2017 08:30:24 +0000 (UTC)
commit d68a66cf0430aa8f271c0ba504c422c54d8c01ab
Author: Daiki Ueno <dueno src gnome org>
Date: Mon May 22 10:27:26 2017 +0200
secret: Don't assume schema attributes are always present
It is possible that an attribute is defined in a schema but missing in
the actual attributes stored in an secret item.
src/secret-schema.vala | 21 ++++++++++++++-------
1 files changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/src/secret-schema.vala b/src/secret-schema.vala
index 3bdaf91..585a733 100644
--- a/src/secret-schema.vala
+++ b/src/secret-schema.vala
@@ -127,13 +127,15 @@ namespace Credentials {
public override string get_title (SecretItem item) {
var value = get_attribute (item, ATTR_URI);
- return_val_if_fail (value != null, "");
+ if (value == null)
+ return "";
return format_attribute (ATTR_URI, value);
}
public override string? get_secondary_title (SecretItem item) {
var value = get_attribute (item, ATTR_USERNAME);
- return_val_if_fail (value != null, null);
+ if (value == null)
+ return null;
return format_attribute (ATTR_USERNAME, value);
}
}
@@ -150,7 +152,8 @@ namespace Credentials {
public override string get_title (SecretItem item) {
var value = get_attribute (item, ATTR_ORIGIN_URI);
- return_val_if_fail (value != null, "");
+ if (value == null)
+ return "";
return format_attribute (ATTR_ORIGIN_URI, value);
}
}
@@ -171,13 +174,15 @@ namespace Credentials {
public override string get_title (SecretItem item) {
var value = get_attribute (item, ATTR_DOMAIN);
- return_val_if_fail (value != null, "");
+ if (value == null)
+ return "";
return format_attribute (ATTR_DOMAIN, value);
}
public override string? get_secondary_title (SecretItem item) {
var value = get_attribute (item, ATTR_USER);
- return_val_if_fail (value != null, null);
+ if (value == null)
+ return null;
return format_attribute (ATTR_USER, value);
}
}
@@ -198,13 +203,15 @@ namespace Credentials {
public override string get_title (SecretItem item) {
var value = get_attribute (item, ATTR_NAME);
- return_val_if_fail (value != null, "");
+ if (value == null)
+ return "";
return format_attribute (ATTR_NAME, value);
}
public override string? get_secondary_title (SecretItem item) {
var value = get_attribute (item, ATTR_EMAIL);
- return_val_if_fail (value != null, null);
+ if (value == null)
+ return null;
return format_attribute (ATTR_EMAIL, value);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]