Fix segfault when undoing marker deletion

find_location_markers() may return NULL.
This also consolidates code from acc55083e5
This commit is contained in:
Robin Gareus 2023-08-30 20:46:20 +02:00
parent aaff022fd2
commit 797c362500
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
1 changed files with 7 additions and 9 deletions

View File

@ -663,21 +663,19 @@ Editor::update_section_rects ()
double const left = sample_to_pixel (start.samples ());
double const right = sample_to_pixel (end.samples ());
Editor::LocationMarkers* markers = find_location_markers (l);
ArdourCanvas::Rectangle* rect = new ArdourCanvas::Rectangle (section_marker_bar, ArdourCanvas::Rect (left, 1, right, timebar_height));
rect->set_fill (true);
rect->set_outline_what(ArdourCanvas::Rectangle::What(0));
rect->raise_to_top ();
if (bright) {
markers->set_color("arrangement rect");
rect->set_fill_color (UIConfiguration::instance().color ("arrangement rect"));
} else {
markers->set_color("arrangement rect alt");
rect->set_fill_color (UIConfiguration::instance().color ("arrangement rect alt"));
std::string const color = bright ? "arrangement rect" : "arrangement rect alt";
rect->set_fill_color (UIConfiguration::instance().color (color));
Editor::LocationMarkers* markers = find_location_markers (l);
if (markers) {
markers->set_color (color);
}
bright = !bright;
}
} while (l);
}