vimode: Don't crash when given a range for a nonexistent command.
ClosedPublic

Authored by flherne on May 25 2016, 3:41 PM.

Details

Summary

When entering a range for a nonexistent command ,p is dereferenced before the null check.
Move that check to before p is used.

BUG: 360418

Test Plan

Recompiled, no new warnings, doesn't segfault anymore.

Perhaps could use an automated test to ensure it doesn't come back, but I don't know how those are done here. Can someone explain?

Diff Detail

Repository
R39 KTextEditor
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
flherne updated this revision to Diff 4002.May 25 2016, 3:41 PM
flherne retitled this revision from to vimode: Don't crash when given a range for a nonexistent file..
flherne updated this object.
flherne edited the test plan for this revision. (Show Details)
flherne added a reviewer: KTextEditor.
flherne set the repository for this revision to R39 KTextEditor.
Restricted Application added a subscriber: kwrite-devel. · View Herald TranscriptMay 25 2016, 3:41 PM
dhaumann accepted this revision.May 26 2016, 1:20 PM
dhaumann added a reviewer: dhaumann.
dhaumann added a subscriber: dhaumann.

I think the patch look good, can you please commit ?

This revision is now accepted and ready to land.May 26 2016, 1:20 PM

Sorry, I don't have commit access (this is only my second KDE patch).

flherne retitled this revision from vimode: Don't crash when given a range for a nonexistent file. to vimode: Don't crash when given a range for a nonexistent command..May 26 2016, 2:25 PM
flherne edited edge metadata.

Sorry, I don't have commit access (this is only my second KDE patch).

Nothing to be sorry about, thanks for your fix!
Commited now.