add some assert() messages.
authorRobin Gareus <robin@gareus.org>
Mon, 17 Nov 2014 02:49:19 +0000 (03:49 +0100)
committerRobin Gareus <robin@gareus.org>
Mon, 17 Nov 2014 02:49:19 +0000 (03:49 +0100)
as hints clang static analyzer "Called C++ object pointer is null"

gtk2_ardour/ardour_ui.cc
gtk2_ardour/editor_route_groups.cc
libs/ardour/tempo.cc

index ac35e0db79985cc85478eb9caa391efb138c8694..246d19a96918ccd559e6b5867316eb77cc0c6ee5 100644 (file)
@@ -4029,6 +4029,8 @@ ARDOUR_UI::plugin_scan_dialog (std::string type, std::string plugin, bool can_ca
                scan_dlg->get_vbox()->pack_start (*scan_tbox, PACK_SHRINK, 4);
        }
 
+       assert(scan_dlg && scan_tbox && cancel_button);
+
        if (type == X_("closeme")) {
                scan_dlg->hide();
        } else {
index c7a148304b2da1a62d0259ed22b4c9c88d311e56..6d56b7d8c0395612cd7ccd75e056462510d40281 100644 (file)
@@ -473,6 +473,7 @@ EditorRouteGroups::groups_changed ()
 void
 EditorRouteGroups::property_changed (RouteGroup* group, const PropertyChange&)
 {
+       assert(group);
        _in_row_change = true;
 
        Gtk::TreeModel::Children children = _model->children();
index 5e50e8e02b48dee0494ecc5a5826a417488f1146..6f3f7341160dd6e84cf33e9720131fc49b1c7c81 100644 (file)
@@ -765,6 +765,8 @@ TempoMap::recompute_map (bool reassign_tempo_bbt, framepos_t end)
                }
        }
 
+       assert(meter);
+
        for (Metrics::iterator i = metrics.begin(); i != metrics.end(); ++i) {
                TempoSection* ts;
 
@@ -774,6 +776,8 @@ TempoMap::recompute_map (bool reassign_tempo_bbt, framepos_t end)
                }
        }
 
+       assert(tempo);
+
        /* assumes that the first meter & tempo are at frame zero */
        current_frame = 0;
        meter->set_frame (0);
@@ -1840,6 +1844,7 @@ TempoMap::framepos_plus_beats (framepos_t pos, Evoral::MusicalTime beats) const
           tempo       -> the Tempo for "pos"
           next_tempo  -> first tempo after "pos", possibly metrics.end()
        */
+       assert(tempo);
 
        DEBUG_TRACE (DEBUG::TempoMath,
                     string_compose ("frame %1 plus %2 beats, start with tempo = %3 @ %4\n",
@@ -1941,6 +1946,7 @@ TempoMap::framepos_minus_beats (framepos_t pos, Evoral::MusicalTime beats) const
                }
        }
 
+       assert(tempo);
        DEBUG_TRACE (DEBUG::TempoMath,
                     string_compose ("frame %1 minus %2 beats, start with tempo = %3 @ %4 prev at beg? %5\n",
                                     pos, beats, *((const Tempo*)tempo), tempo->frame(),
@@ -2169,7 +2175,6 @@ TempoMap::framewalk_to_beats (framepos_t pos, framecnt_t distance) const
           tempo -> the Tempo for "pos"
           next_tempo -> the next tempo after "pos", possibly metrics.end()
        */
-
        assert (tempo);
 
        DEBUG_TRACE (DEBUG::TempoMath,