From 9998e761a427d18f65d2e3b04b5f8b2038434de5 Mon Sep 17 00:00:00 2001 From: Bart van Strien Date: Mon, 15 Aug 2016 17:12:36 +0200 Subject: [PATCH] Do not error in newVideo when optionally loading audio with love.audio disabled (fixes #1206) --- src/modules/graphics/opengl/wrap_Graphics.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/modules/graphics/opengl/wrap_Graphics.lua b/src/modules/graphics/opengl/wrap_Graphics.lua index 8c962487e..4beed4780 100644 --- a/src/modules/graphics/opengl/wrap_Graphics.lua +++ b/src/modules/graphics/opengl/wrap_Graphics.lua @@ -352,13 +352,17 @@ function love.graphics.newVideo(file, loadaudio) local video = love.graphics._newVideo(file) local source, success - if loadaudio ~= false then + if loadaudio ~= false and love.audio then success, source = pcall(love.audio.newSource, video:getStream():getFilename()) end if success then video:setSource(source) elseif loadaudio == true then - error("Video had no audio track", 2) + if love.audio then + error("Video had no audio track", 2) + else + error("love.audio was not loaded", 2) + end else video:getStream():setSync() end