diff --git a/src/qml/qmlautoreload.cpp b/src/qml/qmlautoreload.cpp index 1011282e782..ef717223fbc 100644 --- a/src/qml/qmlautoreload.cpp +++ b/src/qml/qmlautoreload.cpp @@ -36,7 +36,10 @@ void QmlAutoReload::slotFileChanged(const QString& changedFile) { } void QmlAutoReload::clear() { - m_fileWatcher.removePaths(m_fileWatcher.files()); + const auto files = m_fileWatcher.files(); + if (!files.isEmpty()) { + m_fileWatcher.removePaths(files); + } } } // namespace qml