From e1fd9daa83817eb3b6fca57fcec18f8572e10acb Mon Sep 17 00:00:00 2001 From: Michael Gratton Date: Mon, 14 Jan 2019 18:03:47 +1100 Subject: [PATCH] Fix pathological FolderPath.is_equal() case, add unit test --- src/engine/api/geary-folder-path.vala | 2 +- test/engine/api/geary-folder-path-test.vala | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/engine/api/geary-folder-path.vala b/src/engine/api/geary-folder-path.vala index 4f01d168..a33ade74 100644 --- a/src/engine/api/geary-folder-path.vala +++ b/src/engine/api/geary-folder-path.vala @@ -207,7 +207,7 @@ public class Geary.FolderPath : FolderPath? a = this; FolderPath? b = other; - while (a != null && b != null) { + while (a != null || b != null) { if (a == b) { return true; } diff --git a/test/engine/api/geary-folder-path-test.vala b/test/engine/api/geary-folder-path-test.vala index c1c16643..18db7308 100644 --- a/test/engine/api/geary-folder-path-test.vala +++ b/test/engine/api/geary-folder-path-test.vala @@ -134,6 +134,12 @@ public class Geary.FolderPathTest : TestCase { .equal_to(this.root.get_child("test2").get_child("test")), "Disjoint parents" ); + + assert_false( + this.root.get_child("test").equal_to( + this.root.get_child("").get_child("test")), + "Pathological case" + ); } public void path_hash() throws GLib.Error {