From 80c348d00a3f9a12f599b58526806f45453df648 Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 28 Apr 2025 11:14:39 +0200 Subject: [PATCH] TextEditor: Don't crash when trying to remove from empty bookmark list Fixes: QTCREATORBUG-32774 Change-Id: I74e77822051c794f4a932cbe5c064650bcafcf3b Reviewed-by: David Schulz --- src/plugins/texteditor/bookmarkmanager.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/texteditor/bookmarkmanager.cpp b/src/plugins/texteditor/bookmarkmanager.cpp index 3e22d9fff77..fd9b4725526 100644 --- a/src/plugins/texteditor/bookmarkmanager.cpp +++ b/src/plugins/texteditor/bookmarkmanager.cpp @@ -648,6 +648,8 @@ void BookmarkManager::removeAllBookmarks() void BookmarkManager::deleteBookmark(Bookmark *bookmark) { int idx = m_bookmarksList.indexOf(bookmark); + if (idx < 0) + return; beginRemoveRows(QModelIndex(), idx, idx); m_bookmarksMap[bookmark->filePath()].removeAll(bookmark);