From c826566ce341cfa6bb02c733a5c70e26542bee9e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 3 May 2015 03:28:43 +1000 Subject: Sound now returns even if file fails to load With various codecs its hard to ensure a sound will load or not. --- source/blender/editors/sound/sound_ops.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source/blender/editors/sound') diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index bce9a375091..8a3b48125d0 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -51,6 +51,7 @@ #include "BKE_global.h" #include "BKE_main.h" #include "BKE_report.h" +#include "BKE_library.h" #include "BKE_packedFile.h" #include "BKE_scene.h" #include "BKE_sound.h" @@ -105,8 +106,9 @@ static int sound_open_exec(bContext *C, wmOperator *op) if (!op->customdata) sound_open_init(C, op); - if (sound == NULL || sound->playback_handle == NULL) { + if (sound->playback_handle == NULL) { if (op->customdata) MEM_freeN(op->customdata); + BKE_libblock_free(bmain, sound); BKE_report(op->reports, RPT_ERROR, "Unsupported audio format"); return OPERATOR_CANCELLED; } -- cgit v1.2.3