diff --git a/tests/cefclient/browser/client_handler.cc b/tests/cefclient/browser/client_handler.cc index a02f4c872..a1699f28e 100644 --- a/tests/cefclient/browser/client_handler.cc +++ b/tests/cefclient/browser/client_handler.cc @@ -1422,7 +1422,8 @@ void ClientHandler::SetOfflineState(CefRefPtr browser, void ClientHandler::FilterMenuModel(CefRefPtr model) { // Evaluate from the bottom to the top because we'll be removing menu items. - for (size_t i = model->GetCount() - 1; i >= 0; --i) { + for (size_t x = model->GetCount(); x > 0; --x) { + const auto i = x - 1; const auto type = model->GetTypeAt(i); if (type == MENUITEMTYPE_SUBMENU) { // Filter sub-menu and remove if empty.