Folder::showSyncResultPopup: Fix undefined behavior when there is no errors
authorOlivier Goffart <ogoffart@woboq.com>
Thu, 16 Mar 2017 15:30:28 +0000 (16:30 +0100)
committerOlivier Goffart <olivier@woboq.com>
Mon, 20 Mar 2017 10:53:13 +0000 (11:53 +0100)
commit722918abd647f55fa7ceb2018103ca5ee11cce58
tree9e511df433931213cebdc0f14b6f19f8a279b97a
parent48fe8d1cb8c8e1ecb53332ec9c844495bb99219c
Folder::showSyncResultPopup: Fix undefined behavior when there is no errors

When there is no errors  _syncResult.firstItemError() is NULL, and accessing
it's _file member is an undefined behavior. (Thankfully, createGuiLog did not
use the string when the count was 0, but we are not supposed to create
null references.

Found with the UB sanitizer:

src/gui/folder.cpp:348:49: runtime error: member access within null pointer of type 'OCC::SyncFileItem'
src/gui/folder.cpp:348:19: runtime error: reference binding to null pointer of type 'const QString'
src/gui/folder.cpp