kstart: Prevent crash when running without args
ClosedPublic

Authored by tasossahanidis on Jul 21 2019, 2:30 PM.

Details

Summary

Despite an error being thrown, kstart would continue, trying to
access an item that didn't exist in parser's arguments QList.

Display the help message and exit instead.

Signed-off-by: Tasos Sahanidis <tasos@tasossah.com>

Diff Detail

Repository
R126 KDE CLI Utilities
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
tasossahanidis created this revision.Jul 21 2019, 2:30 PM
Restricted Application added a project: Plasma. · View Herald TranscriptJul 21 2019, 2:30 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
tasossahanidis requested review of this revision.Jul 21 2019, 2:30 PM
davidedmundson accepted this revision.Jul 21 2019, 2:54 PM
This revision is now accepted and ready to land.Jul 21 2019, 2:54 PM
apol added a subscriber: apol.Jul 21 2019, 3:18 PM

LGTM otherwise

kstart/kstart.cpp
355
if ( parser.positionalArguments().isEmpty() ) {

kstart: Use isEmpty()

tasossahanidis marked an inline comment as done.Jul 22 2019, 12:11 PM

Assuming I did everything correctly, it should be okay now.

apol accepted this revision.Jul 22 2019, 8:54 PM
This revision was automatically updated to reflect the committed changes.