diff layer/LayerFactory.h @ 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 f2525e6cbdf1
children 0fa155b84bac
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;
     }