diff options
Diffstat (limited to 'src/corelib/io/qtemporaryfile.cpp')
-rw-r--r-- | src/corelib/io/qtemporaryfile.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index 55d13dad70..c016a622c7 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -284,8 +284,10 @@ createUnnamedFile(NativeFileHandle &file, QTemporaryFileName &tfn, quint32 mode, return CreateUnnamedFileStatus::NotSupported; const char *p = "."; - int lastSlash = tfn.path.lastIndexOf('/'); - if (lastSlash != -1) { + QByteArray::size_type lastSlash = tfn.path.lastIndexOf('/'); + if (lastSlash >= 0) { + if (lastSlash == 0) + lastSlash = 1; tfn.path[lastSlash] = '\0'; p = tfn.path.data(); } |