From 91dd2e6ee774d48d261cfcd69672bc99aa6fc4ad Mon Sep 17 00:00:00 2001 From: Alexei Stukov Date: Sun, 30 Apr 2017 14:16:27 +0300 Subject: [PATCH] Fix for pluginpanel crashing --- js/main.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/js/main.js b/js/main.js index a7ae28e..8ffce8a 100644 --- a/js/main.js +++ b/js/main.js @@ -3863,7 +3863,9 @@ class V2C_PluginCard extends BDV2.reactComponent { constructor(props) { super(props); let self = this; - self.settingsPanel = self.props.plugin.getSettingsPanel(); + if (typeof self.props.plugin.getSettingsPanel === "function") { + self.settingsPanel = self.props.plugin.getSettingsPanel(); + } self.onChange = self.onChange.bind(self); self.showSettings = self.showSettings.bind(self); self.setInitialState(); @@ -3943,7 +3945,7 @@ class V2C_PluginCard extends BDV2.reactComponent { BDV2.react.createElement("input", { checked: this.state.checked, onChange: this.onChange, className: "ui-switch-checkbox", type: "checkbox" }), BDV2.react.createElement("div", { className: "ui-switch" }) ), - BDV2.react.createElement( + this.settingsPanel && BDV2.react.createElement( "button", { onClick: this.showSettings }, "Settings" @@ -3966,6 +3968,7 @@ class V2C_PluginCard extends BDV2.reactComponent { } showSettings() { + if (!this.settingsPanel) return; this.setState({ 'settings': true });