From 1c0bef3f85297a159e3ab0e848529a089a226970 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 29 Jun 2021 01:53:56 +0200 Subject: [PATCH] Remove redundant checks update_ghost_note() can only be called with a valid, non-null _ghost_note. Explicit checks trigger clang static analyzer to report false positives, since _ghost_note is unconditionally used in this method as well. --- gtk2_ardour/midi_region_view.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index df68cb8460..d5456a2dc6 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -3934,6 +3934,7 @@ MidiRegionView::selection_as_notelist (Notes& selected, bool allow_all_if_none_s void MidiRegionView::update_ghost_note (double x, double y, uint32_t state) { + assert (_ghost_note); x = std::max(0.0, x); MidiTimeAxisView* const mtv = dynamic_cast(&trackview); @@ -3959,14 +3960,13 @@ MidiRegionView::update_ghost_note (double x, double y, uint32_t state) } /* ghost note may have been snapped before region */ - if (_ghost_note && snapped_beats.to_double() < 0.0) { + if (snapped_beats.to_double() < 0.0) { _ghost_note->hide(); return; - - } else if (_ghost_note) { - _ghost_note->show(); } + _ghost_note->show(); + /* calculate time in beats relative to start of source */ const Temporal::Beats length = get_grid_beats(unsnapped_sample + _region->position());