1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

[Bookmarks] Fixed assert when migrating bookmarks

Assert when user had bookmark with folder that doesn't exists
Also save bookmarks as soon as they are migrated

Closes #1213
This commit is contained in:
nowrep 2014-02-13 16:35:52 +01:00
parent b880a920ff
commit 851e19ce01
2 changed files with 7 additions and 2 deletions

View File

@ -262,7 +262,12 @@ void Bookmarks::init()
m_folderUnsorted->setTitle(tr("Unsorted Bookmarks")); m_folderUnsorted->setTitle(tr("Unsorted Bookmarks"));
m_folderUnsorted->setDescription(tr("All other bookmarks")); m_folderUnsorted->setDescription(tr("All other bookmarks"));
if (!BookmarksTools::migrateBookmarksIfNecessary(this)) { if (BookmarksTools::migrateBookmarksIfNecessary(this)) {
// Bookmarks migrated just now, let's save them ASAP
saveBookmarks();
}
else {
// Bookmarks don't need to be migrated, just load them as usual
loadBookmarks(); loadBookmarks();
} }

View File

@ -376,7 +376,7 @@ bool BookmarksTools::migrateBookmarksIfNecessary(Bookmarks* bookmarks)
const QUrl url = query.value(2).toUrl(); const QUrl url = query.value(2).toUrl();
BookmarkItem* parent = folders.value(folder); BookmarkItem* parent = folders.value(folder);
if (folder.isEmpty()) { if (!parent) {
parent = bookmarks->unsortedFolder(); parent = bookmarks->unsortedFolder();
} }
Q_ASSERT(parent); Q_ASSERT(parent);