[gitg] fix libgitg-date test package failure
- From: Alberto Fanjul <albfan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg] fix libgitg-date test package failure
- Date: Wed, 3 Nov 2021 14:12:15 +0000 (UTC)
commit b9f102c760adaee8185567007bcbe3b6604754f2
Author: Mahmoud Khalil <mahmoudkhalil11 gmail com>
Date: Sun Oct 31 22:37:11 2021 +0200
fix libgitg-date test package failure
This commit fixes libgitg-date test package failure by checking on the
values returned from the GLib.MatchInfo.fetch_named method if they
were empty strings as well. According to the documentation here:
https://docs.gtk.org/glib/method.MatchInfo.fetch_named.html
the values returned from this method can be NULL values as well as
empty strings
libgitg/gitg-date.vala | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/libgitg/gitg-date.vala b/libgitg/gitg-date.vala
index 9e4e8010..efdb4fc7 100644
--- a/libgitg/gitg-date.vala
+++ b/libgitg/gitg-date.vala
@@ -140,7 +140,7 @@ public class Date : Object, Initable
{
string? val = info.fetch_named(name);
- if (val == null)
+ if (val == null || val == "")
{
return false;
}
@@ -169,7 +169,7 @@ public class Date : Object, Initable
string? tzs = info.fetch_named("tz");
- if (tzs != null)
+ if (tzs != null && tzs != "")
{
var ret = new DateTime.from_unix_utc(unixt);
return ret.to_timezone(new TimeZone(tzs));
@@ -200,7 +200,7 @@ public class Date : Object, Initable
string? tzs = info.fetch_named("tz");
- if (tzs != null)
+ if (tzs != null && tzs != "")
{
tz = new TimeZone(tzs);
}
@@ -247,7 +247,7 @@ public class Date : Object, Initable
string? tzs = info.fetch_named("tz");
- if (tzs != null)
+ if (tzs != null && tzs != "")
{
tz = new TimeZone(tzs);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]