[icinga-checkins] icinga.org: icinga2/master: Fix crash in ScriptFrame::AddImport

git at icinga.org git at icinga.org
Fri Aug 12 15:22:11 CEST 2016


Module: icinga2
Branch: master
Commit: 491acb62eae721179befb4e5f82042db86c2fe47
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=491acb62eae721179befb4e5f82042db86c2fe47

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Fri Aug 12 15:20:41 2016 +0200

Fix crash in ScriptFrame::AddImport

refs #12408

---

 lib/base/scriptframe.cpp |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lib/base/scriptframe.cpp b/lib/base/scriptframe.cpp
index 643cc55..8f4fa80 100644
--- a/lib/base/scriptframe.cpp
+++ b/lib/base/scriptframe.cpp
@@ -120,8 +120,15 @@ Array::Ptr ScriptFrame::GetImports(void)
 
 void ScriptFrame::AddImport(const Object::Ptr& import)
 {
-	Array::Ptr imports = m_Imports->ShallowClone();
+	Array::Ptr imports;
+
+	if (!m_Imports)
+		imports = new Array();
+	else
+		imports = m_Imports->ShallowClone();
+
 	imports->Add(import);
+
 	m_Imports = imports;
 }
 



More information about the icinga-checkins mailing list