Audio Channel Issues - NullPointerReferenced - Emulating in Wine

Started by xil, Mon 23/03/2015 18:24:53

Previous topic - Next topic

xil

Hi guys,

I've got this piece of code in room1.asc:

Code: ags

function room_Load(){
  interface_toggle(false);
  achM = aM1.Play();
}


It's then followed up in room14.asc with this:

Code: ags

function room_Load(){
  interface_toggle(false);
  achM.Stop();
}


A user emulating in Wine is saying they get the following error:

Quoteroom14.asc, line 3
NullPointerReferenced.

So in summary, I've got a global value 'achM' set to an audio channel and I play some music in it in the first room, then for the outro I stop the music. I have no issues with this on a PC so does anyone have any ideas as to why it doesn't work in Wine or how I can possibly stop it from crashing?
Calico Reverie - Independent Game Development, Pixel Art & Other Stuff
Games: Mi - Starlit Grave - IAMJASON - Aractaur - blind to siberia - Wrong Channel - Memoriae - Point Of No Return

Gurok

Not sure from your description whether the music plays for the person emulating in Wine. But anyway, I don't think you're guaranteed to get a non-null pointer from aM1.Play(). Check for a null pointer before you stop the music:

Code: ags
if(achM != null)
    achM.Stop();


That would be the easiest way to stop it from crashing.
[img]http://7d4iqnx.gif;rWRLUuw.gi

xil

Calico Reverie - Independent Game Development, Pixel Art & Other Stuff
Games: Mi - Starlit Grave - IAMJASON - Aractaur - blind to siberia - Wrong Channel - Memoriae - Point Of No Return

SMF spam blocked by CleanTalk