File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -181,18 +181,24 @@ class NAMFileBrowserControl : public IDirBrowseControlBase
181181 void OnAttached () override
182182 {
183183 auto prevFileFunc = [&](IControl* pCaller) {
184+ const auto nItems = NItems ();
185+ if (nItems == 0 )
186+ return ;
184187 mSelectedIndex --;
185188
186189 if (mSelectedIndex < 0 )
187- mSelectedIndex = NItems () - 1 ;
190+ mSelectedIndex = nItems - 1 ;
188191
189192 LoadFileAtCurrentIndex ();
190193 };
191194
192195 auto nextFileFunc = [&](IControl* pCaller) {
196+ const auto nItems = NItems ();
197+ if (nItems == 0 )
198+ return ;
193199 mSelectedIndex ++;
194200
195- if (mSelectedIndex >= NItems () )
201+ if (mSelectedIndex >= nItems )
196202 mSelectedIndex = 0 ;
197203
198204 LoadFileAtCurrentIndex ();
@@ -270,7 +276,7 @@ class NAMFileBrowserControl : public IDirBrowseControlBase
270276
271277 void LoadFileAtCurrentIndex ()
272278 {
273- if (mSelectedIndex > -1 && mSelectedIndex < mItems . GetSize ())
279+ if (mSelectedIndex > -1 && mSelectedIndex < NItems ())
274280 {
275281 WDL_String fileName, path;
276282 GetSelectedFile (fileName);
You can’t perform that action at this time.
0 commit comments