[guid.cpp] fix guid==nullptr comparison retvals

- if guid_1 guid_2 are both null they should return int(0) or bool(true)
This commit is contained in:
Christopher Lam committed 2025-11-29 07:58:04 +08:00
1 parent 7e5f559724
commit 3c5a1801e2
1 file changed
+5 -4
+5 -4
View File
@@ -203,8 +203,8 @@ string_to_guid (const char * str, GncGUID * guid)
gboolean
guid_equal (const GncGUID *guid_1, const GncGUID *guid_2)
{
if (!guid_1 || !guid_2)
return !guid_1 && !guid_2;
if (guid_1 == guid_2) return true;
if (!guid_1 || !guid_2) return false;
gnc::GUID temp1 {*guid_1};
gnc::GUID temp2 {*guid_2};
return temp1 == temp2;
@@ -213,8 +213,9 @@ guid_equal (const GncGUID *guid_1, const GncGUID *guid_2)
gint
guid_compare (const GncGUID *guid_1, const GncGUID *guid_2)
{
if (!guid_1 || !guid_2)
return !guid_1 && !guid_2;
if (guid_1 == guid_2) return 0;
if (!guid_1) return -1;
if (!guid_2) return 1;
gnc::GUID temp1 {*guid_1};
gnc::GUID temp2 {*guid_2};
if (temp1 < temp2)