obs-vst: Allow fetching source properties without source

Per OBS API documentation, `get_properties` can be used to get the
properties of a source, but also of a source type. The latter would
pass a NULL pointer for a given source.

This adds the necessary change to avoid crashing OBS by passing such
a null pointer.
This commit is contained in:
PatTheMav
2022-09-20 13:20:01 +02:00
committed by Ryan Foster
parent 967bce5e15
commit 9c3c2edd6f

View File

@@ -285,7 +285,6 @@ static void fill_out_plugins(obs_property_t *list)
static obs_properties_t *vst_properties(void *data)
{
VSTPlugin *vstPlugin = (VSTPlugin *)data;
obs_properties_t *props = obs_properties_create();
obs_property_t *list = obs_properties_add_list(props, "plugin_path",
PLUG_IN_NAME,
@@ -299,14 +298,21 @@ static obs_properties_t *vst_properties(void *data)
obs_properties_add_button(props, CLOSE_VST_SETTINGS, CLOSE_VST_TEXT,
close_editor_button_clicked);
if (vstPlugin->isEditorOpen()) {
obs_property_set_visible(
obs_properties_get(props, OPEN_VST_SETTINGS), false);
} else {
obs_property_set_visible(
obs_properties_get(props, CLOSE_VST_SETTINGS), false);
bool open_settings_vis = true;
bool close_settings_vis = false;
if (data) {
VSTPlugin *vstPlugin = (VSTPlugin *)data;
if (vstPlugin->isEditorOpen()) {
close_settings_vis = true;
open_settings_vis = false;
}
}
obs_property_set_visible(obs_properties_get(props, OPEN_VST_SETTINGS),
open_settings_vis);
obs_property_set_visible(obs_properties_get(props, CLOSE_VST_SETTINGS),
close_settings_vis);
obs_properties_add_bool(props, OPEN_WHEN_ACTIVE_VST_SETTINGS,
OPEN_WHEN_ACTIVE_VST_TEXT);