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
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 14258
Build 14276: arc lint + arc unit
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 ↗(On Diff #62196)
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.