changeset 1484:b43ff1abdc02 by-id

Fix inability to set layer's model to None
author Chris Cannam
date Wed, 17 Jul 2019 11:20:08 +0100
parents 3943d0720167
children 0e971e3d93e2
files layer/LayerFactory.h
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/layer/LayerFactory.h	Mon Jul 15 13:49:57 2019 +0100
+++ b/layer/LayerFactory.h	Wed Jul 17 11:20:08 2019 +0100
@@ -104,8 +104,10 @@
     bool trySetModel(Layer *layerBase, ModelId modelId) {
         LayerClass *layer = dynamic_cast<LayerClass *>(layerBase);
         if (!layer) return false;
-        auto model = ModelById::getAs<ModelClass>(modelId);
-        if (!model) return false;
+        if (!modelId.isNone()) {
+            auto model = ModelById::getAs<ModelClass>(modelId);
+            if (!model) return false;
+        }
         layer->setModel(modelId);
         return true;
     }