summaryrefslogtreecommitdiff
path: root/gtk2_ardour/linux_vst_gui_support.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-02-21 13:24:20 +0100
committerRobin Gareus <robin@gareus.org>2016-02-21 13:24:20 +0100
commit13552140a2589e12271e3744d9f8b8ab77eeabfe (patch)
tree723ae7b7dca44d43e9b1d4ad5a02d33cf619a871 /gtk2_ardour/linux_vst_gui_support.cc
parent43d3b4656a085011475cd1f6cd60f0beaad687ff (diff)
prevent crash is VST does not implement effEditGetRect
Diffstat (limited to 'gtk2_ardour/linux_vst_gui_support.cc')
-rw-r--r--gtk2_ardour/linux_vst_gui_support.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/gtk2_ardour/linux_vst_gui_support.cc b/gtk2_ardour/linux_vst_gui_support.cc
index 37f046ec28..c86fb946cc 100644
--- a/gtk2_ardour/linux_vst_gui_support.cc
+++ b/gtk2_ardour/linux_vst_gui_support.cc
@@ -689,7 +689,7 @@ vstfx_launch_editor (VSTState* vstfx)
return 0;
Window parent_window;
- struct ERect* er;
+ struct ERect* er = NULL;
int x_size = 1;
int y_size = 1;
@@ -724,11 +724,15 @@ vstfx_launch_editor (VSTState* vstfx)
vstfx->plugin->dispatcher (vstfx->plugin, effEditGetRect, 0, 0, &er, 0 );
- x_size = er->right - er->left;
- y_size = er->bottom - er->top;
+ if (er) {
+ // Don't crash is plugin does not implement effEditGetRect
+ // it'll result in 1x1 px window but that's not our problem :)
+ x_size = er->right - er->left;
+ y_size = er->bottom - er->top;
+ }
- vstfx->width = x_size;
- vstfx->height = y_size;
+ vstfx->width = x_size;
+ vstfx->height = y_size;
XResizeWindow(LXVST_XDisplay, parent_window, x_size, y_size);