Prevent index out of range in case of empty or malformed filename
The Akonadi cache on this computer somehow has an external file missing. Without this change, the IMAP agent crashes on every attempt to start it.
dvratil |
KDE PIM |
Prevent index out of range in case of empty or malformed filename
The Akonadi cache on this computer somehow has an external file missing. Without this change, the IMAP agent crashes on every attempt to start it.
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
Maybe it is better to return an empty string in this case but I don't know. Otherwise I might thave pushed this directly. In the case of my missing file, the returned string was the name of the folder <file_db_data>/00/, which generates an error message that the file it tried to open is actually a folder...
well from the comment above in the code your code makes sence and return an empty string is not intended.
src/private/externalpartstorage.cpp | ||
---|---|---|
98 |
|
src/private/externalpartstorage.cpp | ||
---|---|---|
98 | Replace the whole line with QLatin1Char('0') ? Are you sure? That seems dubious but then I don't know what exactly this code is supposed to do. |
src/private/externalpartstorage.cpp | ||
---|---|---|
98 | no i mean replace revPos > 1 with revPos > 0 |
You are right that the code should return an empty string in case the filename is missing in the payload data. I'll add that in a separate commit since it requires that the situation is correctly handled by all users of this method.
Merging this safety still makes sense in case some other corruption occurs, so please fix the code as Sandro requested.