From 775d6c240b82d30ba932504cc4423269735e228a Mon Sep 17 00:00:00 2001
From: Tobias Knopff <t.knopff@fz-juelich.de>
Date: Wed, 2 Jun 2021 12:49:02 +0200
Subject: [PATCH] Add assert to InstrumentItem::setBackgroundType

---
 GUI/Models/InstrumentItems.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/GUI/Models/InstrumentItems.h b/GUI/Models/InstrumentItems.h
index 58393bb537c..295fbb87237 100644
--- a/GUI/Models/InstrumentItems.h
+++ b/GUI/Models/InstrumentItems.h
@@ -174,6 +174,9 @@ public:
 template <typename T>
 T* InstrumentItem::setBackgroundType()
 {
+    static_assert(std::is_base_of<BackgroundItem,T>::value,
+                  "Class must be derived from BackgroundItem");
+
     return setGroupPropertyType<T>(P_BACKGROUND);
 }
 
-- 
GitLab