Add check to optional value to avoid undefined behavior in MarkerModel

This commit is contained in:
AdenKoperczak 2024-11-27 12:05:04 -05:00
parent ee5719cb55
commit 831e0f7d1b

View file

@ -294,6 +294,10 @@ void MarkerModel::HandleMarkersInitialized(size_t count)
void MarkerModel::HandleMarkerAdded(types::MarkerId id)
{
std::optional<size_t> index = p->markerManager_->get_index(id);
if (!index)
{
return;
}
const int newIndex = static_cast<int>(*index);
beginInsertRows(QModelIndex(), newIndex, newIndex);