old code new update ?

Blitz3D Forums/Blitz3D Programming/old code new update ?

Hay all. Its been a while since I last coded anything in blitz, but during that time I have kept upto date with all updates, not read any of the notes just downloaded them and installed to make sure I was current.

Anyway, long story short I have hit a problem where there wasnt one before.

here is some code.

		If u\life=<0
			FreeSound u\ping
			FreeEntity u\glow
			FreeEntity u\model
			Delete u	
		End If


The type U, is a powerup in the game, the field ping is assigned a channel as follows during the Update phase of all Powerup objects.

I then do a check as I scan them all, if any are mines I check to see if the mine sound is playing, and if not I play it with a channel.

		If u\ptype=pmine
			If ChannelPlaying(u\ping)=False
				u\ping=PlaySound(sonar_snd)
			End If
		End If


This is now giving me an error, not all powerups have a sound in fact only the mines do at the moment, as a warning to let you know they are activated and about to blow.

When a mine blows, the game crashes with a "Sound does not exist".

I am guessing, that something in the last 3 or 4 years was changed with the sounds system, If I am assigning a sound to a field in a type called ping with playsound, how do I free it up once the U object is deleted.