diff options
| author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2016-07-26 11:00:18 +0200 |
|---|---|---|
| committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2016-07-26 11:00:18 +0200 |
| commit | 4f992be36f3a9dbd5a7965701dbd7f010a1e75a8 (patch) | |
| tree | 500ac9ddf365a73a373bb3f45dc3d751b78f294e /lockscreen | |
| parent | c1f5463c91a7528ae013182ad0bc8b832d934fa6 (diff) | |
LockScreenAcceleratorController: ensure callbacks are valid before calling them
Fixes LP: #1605012 (bzr r4153.6.1)
Diffstat (limited to 'lockscreen')
| -rw-r--r-- | lockscreen/LockScreenAcceleratorController.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lockscreen/LockScreenAcceleratorController.cpp b/lockscreen/LockScreenAcceleratorController.cpp index 80436881d..49dbd3bf1 100644 --- a/lockscreen/LockScreenAcceleratorController.cpp +++ b/lockscreen/LockScreenAcceleratorController.cpp @@ -194,10 +194,20 @@ void AcceleratorController::OnActionActivated(CompAction& action) CompOption::Vector options; if (action.state() & CompAction::StateInitKey) - action.initiate()(&action, 0, options); + { + auto const& initiate_cb = action.initiate(); + + if (!initiate_cb.empty()) + initiate_cb(&action, 0, options); + } if (action.state() & CompAction::StateTermKey) - action.terminate()(&action, CompAction::StateTermTapped, options); + { + auto const& terminate_cb = action.terminate(); + + if (!terminate_cb.empty()) + terminate_cb(&action, CompAction::StateTermTapped, options); + } } Accelerators::Ptr const& AcceleratorController::GetAccelerators() const |
