Showing the changes to libraries/script-engine/src/AudioScriptingInterface.cpp (1 of 1 file). Show all
Unified · Split
| @@ -45,8 +45,11 @@ ScriptAudioInjector* AudioScriptingInterface::playSound(Sound* sound, const Audi · 44 unmodified lines | ||
| 45 | 45 | // stereo option isn't set from script, this comes from sound metadata or filename |
| 46 | 46 | AudioInjectorOptions optionsCopy = injectorOptions; |
| 47 | 47 | optionsCopy.stereo = sound->isStereo(); |
| 48 | − | |
| 49 | − return new ScriptAudioInjector(AudioInjector::playSound(sound->getByteArray(), optionsCopy, _localAudioInterface)); | |
| 48 | + auto injector = AudioInjector::playSound(sound->getByteArray(), optionsCopy, _localAudioInterface); | |
| 49 | + if (!injector) { | |
| 50 | + return NULL; | |
| 51 | + } | |
| 52 | + return new ScriptAudioInjector(injector); | |
| 50 | 53 | |
| 51 | 54 | } else { |
| 52 | 55 | qCDebug(scriptengine) << "AudioScriptingInterface::playSound called with null Sound object."; |