Browse Source

only layout xml view children when they have a corresponding parsed element

Kolja Strohm 1 year ago
parent
commit
4037df20eb
1 changed files with 15 additions and 5 deletions
  1. 15 5
      UIMLView.cpp

+ 15 - 5
UIMLView.cpp

@@ -198,11 +198,21 @@ void UIMLElement::layout(XML::Element& element,
     pHeight = z.getInnenHeight();
     // recursive layout
     for (auto i = element.getChilds(); i; i++)
-        generalLayouter.layout(*i.val(),
-            *generalLayouter.zZeichnungById(i->getAttributeValue("id")),
-            pWidth,
-            pHeight,
-            generalLayouter);
+    {
+        Zeichnung* z = 0;
+        if (i->hasAttribute("id"))
+        {
+            z = generalLayouter.zZeichnungById(i->getAttributeValue("id"));
+        }
+        if (z)
+        {
+            generalLayouter.layout(*i.val(),
+                *generalLayouter.zZeichnungById(i->getAttributeValue("id")),
+                pWidth,
+                pHeight,
+                generalLayouter);
+        }
+    }
 }
 
 UIMLContainer::UIMLContainer()