changeset 1018:4a2c150ecd67

Avoid crash when setting alignment to 0
author Chris Cannam
date Thu, 20 Nov 2014 16:18:31 +0000
parents 216c4a06a462
children 9c00e7944bf2
files data/model/Model.cpp
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
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 *