diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-10-22 11:10:33 +0100 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-10-22 13:17:37 +0200 |
commit | 1eda97c39237f0244faccb220b3bdd692340e013 (patch) | |
tree | cb42406c6678e80323f2851661d901389ff94ab3 /sd | |
parent | 42eaab2c8e6cc2fb9cb6f608db6ba4a07cc55409 (diff) |
cid#1548028 silence Explicit null dereferenced
Change-Id: I9f20b9b6febd94e85095dc018908cfa5011741d5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158326
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/sidebar/LayoutMenu.cxx | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/sd/source/ui/sidebar/LayoutMenu.cxx b/sd/source/ui/sidebar/LayoutMenu.cxx index 9022609df7d7..b32cd8f358d8 100644 --- a/sd/source/ui/sidebar/LayoutMenu.cxx +++ b/sd/source/ui/sidebar/LayoutMenu.cxx @@ -529,21 +529,23 @@ void LayoutMenu::Fill() } Clear(); - for (size_t i = 0; i < pInfo.size(); i++) + sal_uInt16 id = 1; + for (const auto& elem : pInfo) { - if ((WritingMode_TB_RL != pInfo[i].meWritingMode) || bVertical) + if ((WritingMode_TB_RL != elem.meWritingMode) || bVertical) { - Image aImg(OUString::Concat("private:graphicrepository/") + pInfo[i].msBmpResId); + Image aImg(OUString::Concat("private:graphicrepository/") + elem.msBmpResId); - if (bRightToLeft && (WritingMode_TB_RL != pInfo[i].meWritingMode)) + if (bRightToLeft && (WritingMode_TB_RL != elem.meWritingMode)) { // FIXME: avoid interpolating RTL layouts. BitmapEx aRTL = aImg.GetBitmapEx(); aRTL.Mirror(BmpMirrorFlags::Horizontal); aImg = Image(aRTL); } - mxLayoutValueSet->InsertItem(i + 1, aImg, SdResId(pInfo[i].mpStrResId)); - mxLayoutValueSet->SetItemData(i + 1, new AutoLayout(pInfo[i].maAutoLayout)); + mxLayoutValueSet->InsertItem(id, aImg, SdResId(elem.mpStrResId)); + mxLayoutValueSet->SetItemData(id, new AutoLayout(elem.maAutoLayout)); + ++id; } } } |