Don't assume `QStandardPaths::locate` succeeds
A QFile was being constructed directly from the result of `QStandardPaths::locate`, which can return an empty string if it fails to find a matching file. Instead we should explicitly check the path is valid by checking if the string is empty - the result of QFile("").exists() is not documented in the Qt documentation, even though the implementation (at time of writing) will return false as expected, so this is effectively fixing undefined behaviour.
parent
b394e37e
Please register or sign in to comment