Police Quest I: In Pursuit of the Death Angel (VGA Remake/DOS/English)
ScummVM 1.4.0git441-g16a0d8e
Windows 7 x64
At the jail, when you put your gun in the sidearms locker, if you quickly click a second time after placing the gun in, the game will crash with the error:
ERROR: lookupSelector(): Attempt to send to non-object or invalid script. Address was 0000:0000.
It's not a huge problem, as it can be avoided easily enough by simply not clicking a second time.
save at the sidearms locker
This bug report is a duplicate of bug #3036933 : "PQ1VGA : Engine Abort When Putting Away Gun at Jail"
https://sourceforge.net/tracker/?func=detail&aid=3036933&group_id=37116&atid=418820
This was closed without being fixed as a minor bug to be dealt with later.
thebluegr: Could you take a look again at this one?
Fixed in rev 48140a0
This is a rather bad fix, as it can cause heisenbugs in just about all other SCI games. Moreover, it potentially "taints" all savegames made with this revision. Please revert!
The buggy script in question is 937
A slight update on this:
The crash happens in script 937, as mentioned, inside IconBar::handleEvent. Here's part of the script function in question:
code_0701: push1
pTos curIcon
callk IsObject, $2 <----- check the current icon
bnt code_0733
pushi $1f ; 31, type
push1
pushi $1f ; 31, type
push0
pToa curIcon
send $4
push
pushi $25 ; 37, '%', message
push1
pTos curIcon
pToa useIconItem
eq?
bnt code_0727
pushi $25 ; 37, '%', message
push0
pToa curInvIcon <-------- crash!
send $4
jmp code_072e
This is fairly standard code in many SCI games. The crash occurs because the inventory object is destroyed with the first click, so when clicking the second time, the code will attempt to check it again and crash.
This is a racing condition: after clicking the first time to place the weapon, the locker screen should close, however it remains functional for some seconds, which is why the crash occurs.
IMHO, the correct way to resolve this would be to either remove the delay after the gun is placed, and close the locker screen immediately, or disable any actions on the locker after the gun is placed.
finally fixed today by ed865856dc1b486c52e0a22ae6d39f686e9a79ab