Null Reference Exception Playing SoundStream
- Vorherrschende Sprache
- C#
- Sterne
- 194
- Forks
- 20
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
```
private bool doEmitSound(PlaySFX req, GameState state, Instant instant)
{
if (!allowSFX)
return true;
state.Messages.EmitMsg(new ConsoleInput($"Playing {req.Resource}"));
if (!soundboard.ContainsKey(req.Resource))
soundboard.Add(req.Resource, new SoundStream(AssetManager.FindFileStream(req.Resource), sfxEngine));
soundboard[req.Resource].Volume = (currentVolume * req.Volume);//Should be at most 1*1.
soundboard[req.Resource].Play();
return true;
}
```
This code plays the sound as expected the first time, but fails with a null reference exception when the volume property is modified or the play method is called. the second time regardless of being a new SoundStream or an existing SoundStream.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Bewertung
Dieses Issue wurde noch nicht bewertet.