mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 21:20:06 +00:00
Add check to optional value to avoid undefined behavior in MarkerModel
This commit is contained in:
parent
ee5719cb55
commit
831e0f7d1b
1 changed files with 4 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue