Bug on foreach with empty list & MsgOnEmpty

Things you’d like to miss in the future...
Forum rules
:warnred20: :warnred20: :warnred20: :warnred20: :warnred20: READ THIS AND DO IT!!! :warnred20: :warnred20: :warnred20: :warnred20: :warnred20:

:info: Please include the following information:
1) Your XYplorer Version (e.g., v28.00.0801)
2) Your Windows Version (e.g., Win 11)
3) Your Screen Scaling Percentage (e.g., 125%).

:info: We strongly recommend adding your Windows Version and Screen Scaling Percentage to the Location field in your Profile or to your Signature. That way, you only have to type them once, and we won't have to search for that vital information.

:info: When attaching an Image, please use the Attachment tab at the bottom of your post and click "Add files".

:warnred20: :warnred20: :warnred20: :warnred20: :warnred20: READ THIS AND DO IT!!! :warnred20: :warnred20: :warnred20: :warnred20: :warnred20:
Post Reply
PeterH
Posts: 2830
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Bug on foreach with empty list & MsgOnEmpty

Post by PeterH »

If foreach has an empty list, and MsgOnEmpty is specified, XY says that 1st parm is invalid. This is definitely wrong.

Example script: 2 foreach run OK, 3rd & 4th show error. (Click Continue!)
(In real situation the list is a list of files, that can be empty.)

And maybe: a misunderstanding. What *should* MsgOnEmpty really do? And what should happen to the 'returned' var ($v) in this case?
(My expectations seem to be wrong... :whistle: )
To see the attached files, you need to log into the forum.

admin
Site Admin
Posts: 66573
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Bug on foreach with empty list & MsgOnEmpty

Post by admin »

Confirmed, that's a bug (born 20220816). Fix comes. :tup:

PeterH
Posts: 2830
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

[solves] Bug on foreach with empty list & MsgOnEmpty

Post by PeterH »

Bug is gone :tup:
Thanks!

Now it still doesn't do what I expected. But what help documents. :oops:
No problem: I only wanted to use it because I misunderstood. Now it's easy to check for an empty list before the foreach.

So: all is fine again :beer:

Post Reply