diff data/model/Model.cpp @ 1018:4a2c150ecd67

Avoid crash when setting alignment to 0
author Chris Cannam
date Thu, 20 Nov 2014 16:18:31 +0000
parents 4b9fc70a37d5
children cc27f35aa75c
line wrap: on
line diff
--- a/data/model/Model.cpp	Thu Nov 20 15:47:05 2014 +0000
+++ b/data/model/Model.cpp	Thu Nov 20 16:18:31 2014 +0000
@@ -85,9 +85,13 @@
         m_alignment->aboutToDelete();
         delete m_alignment;
     }
+    
     m_alignment = alignment;
-    connect(m_alignment, SIGNAL(completionChanged()),
-            this, SIGNAL(alignmentCompletionChanged()));
+
+    if (m_alignment) {
+        connect(m_alignment, SIGNAL(completionChanged()),
+                this, SIGNAL(alignmentCompletionChanged()));
+    }
 }
 
 const AlignmentModel *