aports/community/gitg/Fix-libgitg-date-test-package-failure.patch

59 lines
1.6 KiB
Diff

From b9f102c760adaee8185567007bcbe3b6604754f2 Mon Sep 17 00:00:00 2001
From: Mahmoud Khalil <mahmoudkhalil11@gmail.com>
Date: Sun, 31 Oct 2021 22:37:11 +0200
Subject: [PATCH] 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);
}
--
GitLab