[PATCH] Don't crash if KMountPoint gives nothing back while checking for CIFS
authorKevin Ottens <kevin.ottens@enioka.com>
Fri, 15 Sep 2023 07:45:58 +0000 (09:45 +0200)
committerAurélien COUDERC <coucouf@debian.org>
Thu, 23 May 2024 21:13:17 +0000 (23:13 +0200)
BUG: 474451

Gbp-Pq: Name upstream_48322f44_fix_crash_when_kmountpoint_gives_nothing_on_cifs.patch

src/ioslaves/file/file_unix.cpp

index 58017c21fa53a45549d97db1ade1440eab357991..9b4c16141ac8dc4ab03b9934c472f4d14b2f9a91 100644 (file)
@@ -328,6 +328,9 @@ inline static time_t stat_mtime(const QT_STATBUF &buf)
 static bool isOnCifsMount(const QString &filePath)
 {
     const auto mount = KMountPoint::currentMountPoints().findByPath(filePath);
+    if (!mount) {
+        return false;
+    }
     return mount->mountType() == QStringLiteral("cifs") || mount->mountType() == QStringLiteral("smb3");
 }