Commit 8464df3a authored by Tomáš Trnka's avatar Tomáš Trnka Committed by Laurent Montel
Browse files

Avoid accidentally generating reserved values of feed IDs

(cherry picked from commit 307dde7b)
parent 546db721
Pipeline #57634 canceled with stage
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "kernel.h" #include "kernel.h"
#include "subscriptionlistjobs.h" #include "subscriptionlistjobs.h"
#include <KLocalizedString> #include <KLocalizedString>
#include <limits>
#include <memory> #include <memory>
#include <QElapsedTimer> #include <QElapsedTimer>
...@@ -436,7 +437,8 @@ void FeedList::setRootNode(Folder *folder) ...@@ -436,7 +437,8 @@ void FeedList::setRootNode(Folder *folder)
uint FeedList::generateID() const uint FeedList::generateID() const
{ {
return QRandomGenerator::global()->generate(); // The values 0 and 1 are reserved, see TreeNode::id()
return QRandomGenerator::global()->bounded(2u, std::numeric_limits<quint32>::max());
} }
void FeedList::slotNodeAdded(TreeNode *node) void FeedList::slotNodeAdded(TreeNode *node)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment