Skip to content

Commit 953e9a0

Browse files
committed
Add check for nil source
1 parent 0ba7f99 commit 953e9a0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

SlideshowSettings.lua

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,14 @@ function refresh_source()
9797
-- update images
9898
update_image_list(script_path() .. 'images/')
9999

100-
-- refresh browser source. uses exeldro's method - https://github.com/exeldro/obs-lua/blob/master/refresh-browsers.lua
101100
local source = obs.obs_get_source_by_name(browserSourceName)
101+
if source == nil then
102+
print("Browser source \"" .. browserSourceName .. "\" not found. Be sure to enter the correct source's name in the lua script.")
103+
return
104+
end
102105
local settings = obs.obs_source_get_settings(source)
103106

107+
-- refresh browser source. uses exeldro's method - https://github.com/exeldro/obs-lua/blob/master/refresh-browsers.lua
104108
local fps = obs.obs_data_get_int(settings, "fps")
105109
if fps % 2 == 0 then
106110
obs.obs_data_set_int(settings, "fps", fps + 1)
@@ -114,7 +118,7 @@ end
114118
function getUniqueName(name)
115119
return script_path() .. name
116120
end
117-
121+
118122
-- called when script is loaded
119123
function script_load(settings)
120124
obs.obs_data_set_default_int(settings, "slideDuration", defaultSlideDuration)

0 commit comments

Comments
 (0)