The bounds check in the data() method of PowerButtonActionModeland SleepModeModel was incomplete, so passing an invalid indexsuch as -1 (standard value for "not found") could cause a crash.
For power management settings, a user would run into this crash iftheir configuration from powerdevilrc listed a power button actionthat's not supported on the current system. For example, a usermay have selected "Sleep" as lid action, but subsequently changedtheir systemd configuration to disable suspend-to-RAM because itcaused problems. Or they could have migrated their OS to a newcomputer which does not support Sleep.
Fixing this allows us to assign currentIndex declarativelyinstead of waiting until Component.onCompleted to (hopefully) finda valid item in the model.
(cherry picked from commit 8ecf6430)