Handle empty preview lists

Authored by cordlandwehr on Jul 8 2018, 4:29 PM.



Do not access the first list's element if the list possibly
might be empty.

Diff Detail

R304 KNewStuff
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
cordlandwehr created this revision.Jul 8 2018, 4:29 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptJul 8 2018, 4:29 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
cordlandwehr requested review of this revision.Jul 8 2018, 4:29 PM

Which bug in which context does this fix? The information given is a bit 'thin' ;-)

I am rather familiar with KMoreTools but not with the rest of KNewStuff.

dhaumann accepted this revision.Jul 8 2018, 8:30 PM

In any case, this patch will not break things.

This revision is now accepted and ready to land.Jul 8 2018, 8:30 PM

I had a crash at the respective locations while porting Artikulate to the QtQuick based API, since those KNS resource files do not provide previews.
However, IMO this patch fixes an unsafe access to a list element without checking that it exists.

This revision now requires review to proceed.Jul 8 2018, 8:32 PM
This revision was not accepted when it landed; it landed in state Needs Review.Jul 12 2018, 4:43 PM
This revision was automatically updated to reflect the committed changes.

Somehow removed all reviewers with my last message (sorry!)
Trying to fix this now.