summaryrefslogtreecommitdiffstats
path: root/src/xml/repr-sorting.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/xml/repr-sorting.cpp')
-rw-r--r--src/xml/repr-sorting.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/xml/repr-sorting.cpp b/src/xml/repr-sorting.cpp
index 056236d33..09a39acb2 100644
--- a/src/xml/repr-sorting.cpp
+++ b/src/xml/repr-sorting.cpp
@@ -2,6 +2,7 @@
#include "util/longest-common-suffix.h"
#include "xml/repr.h"
#include "xml/node-iterators.h"
+#include "repr-sorting.h"
static bool same_repr(Inkscape::XML::Node const &a, Inkscape::XML::Node const &b)
{
@@ -13,9 +14,14 @@ Inkscape::XML::Node const *LCA(Inkscape::XML::Node const *a, Inkscape::XML::Node
{
using Inkscape::Algorithms::longest_common_suffix;
Inkscape::XML::Node const *ancestor = longest_common_suffix<Inkscape::XML::NodeConstParentIterator>(
- a, b, NULL, &same_repr
- );
- if ( ancestor && ancestor->type() != Inkscape::XML::DOCUMENT_NODE ) {
+ a, b, NULL, &same_repr);
+ bool OK = false;
+ if (ancestor) {
+ if (ancestor->type() != Inkscape::XML::DOCUMENT_NODE) {
+ OK = true;
+ }
+ }
+ if ( OK ) {
return ancestor;
} else {
return NULL;