Perhaps not related to the changes in Switch and no doubt crappy code but:
I've isolated this to the code snippet below.
Before v1.1.36.00 this worked and didn't give an error and the code worked.
(in as far as I could test it - and it does what I need it to)
I can "fix it" by
1. Inserting a MsgBox
2. Quoting the "case" value so Case "1": works, Case 1: does not
Code: Select all
MsgBox % SetIcon("","",3,5) ; generates error
SetIcon(text,script,ShortCutSearchGui,ShortCutSearchGuiCounter)
{
; MsgBox % ShortCutSearchGui ; uncomment msgbox and there is no Critical Error
If (script = "")
{
IconVal := "Icon1"
If RegExMatch(text[1] text[2],"i)\[\[html|md\]\]")
IconVal:="Icon3"
If RegExMatch(text[1] text[2],"i)\[\[rtf\=")
IconVal:="Icon4"
If RegExMatch(text[1] text[2],"i)\[\[image\=")
IconVal:="Icon5"
}
else
{
IconVal := "Icon2"
If RegExMatch(text[1] text[2],"i)\[\[html|md\]\]")
IconVal:="Icon6"
If RegExMatch(text[1] text[2],"i)\[\[rtf\=")
IconVal:="Icon7"
If RegExMatch(text[1] text[2],"i)\[\[image\=")
IconVal:="Icon8"
}
if (ShortCutSearchGui = 1)
Return IconVal
If (IconVal = "Icon1") ; texticon
{
Switch ShortCutSearchGuiCounter
{
default: IconVal:="Icon1"
Case 1: IconVal:="Icon9"
;Case "1": IconVal:="Icon9" ; quoting prevents error
}
}
Return IconVal
}
Critical Error: Invalid memory read/write.
Line#
023: if RegExMatch(text[1] text[2],"i)\[\[image\=")
024: IconVal := "Icon8"
025: }
026: if (ShortCutSearchGui = 1)
027: Return,IconVal
029: if (IconVal = "Icon1")
030: {
---> 031: Switch ShortCutSearchGuiCounter
032: {
033: Default:
033: IconVal := "Icon1"
034: Case 1:
034: IconVal := "Icon9"
035: Case 2:
035: IconVal := "Icon10"
The program is now unstable and will exit.