Browse Source

Null pointer check

master
Chris Gregan 9 years ago
parent
commit
39ed52499a
  1. 13
      Assets/Fungus/UI/Scripts/WriterAudio.cs

13
Assets/Fungus/UI/Scripts/WriterAudio.cs

@ -231,13 +231,16 @@ namespace Fungus
if (nextBeepTime < Time.realtimeSinceStartup)
{
targetAudioSource.clip = beepSounds[Random.Range(0, beepSounds.Count - 1)];
targetAudioSource.loop = false;
targetVolume = volume;
targetAudioSource.Play();
float extend = targetAudioSource.clip.length;
if (targetAudioSource.clip != null)
{
targetAudioSource.loop = false;
targetVolume = volume;
targetAudioSource.Play();
nextBeepTime = Time.realtimeSinceStartup + extend;
float extend = targetAudioSource.clip.length;
nextBeepTime = Time.realtimeSinceStartup + extend;
}
}
}
}

Loading…
Cancel
Save