diff layer/WaveformLayer.cpp @ 853:99f96cacde36

Fix some potential divide by zeros (from coverity scan)
author Chris Cannam
date Wed, 03 Sep 2014 11:53:43 +0100
parents 4c8ca536b54f
children d282967236d5
line wrap: on
line diff
--- a/layer/WaveformLayer.cpp	Wed Sep 03 11:51:51 2014 +0100
+++ b/layer/WaveformLayer.cpp	Wed Sep 03 11:53:43 2014 +0100
@@ -46,7 +46,8 @@
     m_middleLineHeight(0.5),
     m_aggressive(false),
     m_cache(0),
-    m_cacheValid(false)
+    m_cacheValid(false),
+    m_cacheZoomLevel(0)
 {
     
 }
@@ -1042,7 +1043,7 @@
 
     channels = getChannelArrangement(minChannel, maxChannel,
                                      mergingChannels, mixingChannels);
-
+    if (channels == 0) return 0;
     if (maxChannel < minChannel || channel < minChannel) return 0;
 
     int h = v->height();
@@ -1085,7 +1086,7 @@
 
     channels = getChannelArrangement(minChannel, maxChannel,
                                      mergingChannels, mixingChannels);
-
+    if (channels == 0) return 0;
     if (maxChannel < minChannel) return 0;
 
     int h = v->height();