avoid accessing a temp QString via QStringView after it is deleted

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
This commit is contained in:
Matthieu Gallien 2024-05-14 16:09:16 +02:00 committed by Matthieu Gallien
parent 62661b7a0b
commit ba00c50022

View file

@ -134,9 +134,9 @@ static CSYNC_EXCLUDE_TYPE _csync_excluded_common(const QString &path, bool exclu
{
/* split up the path */
QStringView bname(path);
int lastSlash = path.lastIndexOf(QLatin1Char('/'));
int lastSlash = bname.lastIndexOf(QLatin1Char('/'));
if (lastSlash >= 0) {
bname = path.mid(lastSlash + 1);
bname = bname.mid(lastSlash + 1);
}
qsizetype blen = bname.size();