diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-10-16 14:14:08 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-10-16 17:04:57 +0200 |
commit | 5b554b31827ca378e1ff8beef8d4a9fef539bf4d (patch) | |
tree | a98983c198b160072a9282e198a08eb585427223 /vcl | |
parent | 469e3b5d9f0d4b118ca9237b79401a2b1152eb7d (diff) |
coverity#1440300 rework to silence Using invalid iterator
Change-Id: Icf887a54f0e999c633e4e3f514086c29842427fc
Reviewed-on: https://gerrit.libreoffice.org/61835
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/window/dlgctrl.cxx | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx index c46106f7665e..ccfb6a17c840 100644 --- a/vcl/source/window/dlgctrl.cxx +++ b/vcl/source/window/dlgctrl.cxx @@ -538,17 +538,20 @@ namespace ++aI; aI = std::find_if(aI, rGroup.end(), isSuitableDestination); - if (aI == rGroup.end()) + if (aI != rGroup.end()) { - aI = std::find_if(rGroup.begin(), aStart, isSuitableDestination); - if (aI == aStart) - return false; + vcl::Window *pWindow = *aI; + pWindow->ImplControlFocus( GetFocusFlags::CURSOR | GetFocusFlags::Forward ); + return true; } - - vcl::Window *pWindow = *aI; - - pWindow->ImplControlFocus( GetFocusFlags::CURSOR | GetFocusFlags::Forward ); - return true; + aI = std::find_if(rGroup.begin(), aStart, isSuitableDestination); + if (aI != aStart) + { + vcl::Window *pWindow = *aI; + pWindow->ImplControlFocus( GetFocusFlags::CURSOR | GetFocusFlags::Forward ); + return true; + } + return false; } bool nextInGroup(RadioButton *pSourceWindow, bool bBackward) |