Skip to content

Commit 786f335

Browse files
committed
#3499 navigationwidget: fix build error
Signed-off-by: Patrizio Bekerle <[email protected]>
1 parent c748ef6 commit 786f335

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/widgets/filenavigationwidget.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <QTreeWidgetItemIterator>
2626
#include <QUrl>
2727
#include <algorithm>
28+
#include <limits>
2829

2930
namespace {
3031
constexpr int PositionRole = Qt::UserRole;
@@ -81,8 +82,13 @@ QVector<FileNavigationWidget::FileLinkNode> FileNavigationWidget::parseDocument(
8182
while (it.hasNext()) {
8283
const auto match = it.next();
8384
const QString fileName = QUrl::fromPercentEncoding(match.captured(1).toUtf8());
85+
const qsizetype matchPosition = match.capturedStart(0);
8486

85-
nodes.append({fileName, match.capturedStart(0), pattern.type,
87+
if ((matchPosition < 0) || (matchPosition > std::numeric_limits<int>::max())) {
88+
continue;
89+
}
90+
91+
nodes.append({fileName, static_cast<int>(matchPosition), pattern.type,
8692
pattern.basePath + QDir::separator() + fileName});
8793
}
8894
}

0 commit comments

Comments
 (0)