diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx index bb9e58009d50..86bdf100a73e 100644 --- a/chart2/source/controller/main/ChartController_Window.cxx +++ b/chart2/source/controller/main/ChartController_Window.cxx @@ -2076,7 +2076,7 @@ void ChartController::sendPopupRequest(std::u16string_view rCID, tools::Rectangl // Get dimension index from CID size_t nStartPos = rCID.rfind('.'); - nStartPos++; + nStartPos = (nStartPos == std::u16string_view::npos) ? 0 : (nStartPos + 1); sal_Int32 nEndPos = rCID.size(); std::u16string_view sDimensionIndex = rCID.substr(nStartPos, nEndPos - nStartPos); sal_Int32 nDimensionIndex = o3tl::toInt32(sDimensionIndex); diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index 2d87abed4789..f1443b9c5109 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -3602,8 +3602,9 @@ void ScInterpreter::ScGetPivotData() aFilters.resize(nFilterCount); sal_uInt16 i = nFilterCount; - while (i-- > 0) + while (i > 0) { + --i; /* TODO: also, in case of numeric the entire filter match should * not be on a (even if locale independent) formatted string down * below in pDPObj->GetPivotData(). */