Commit b722d7fb authored by Piotr Gawron's avatar Piotr Gawron

handle cases when plugin data is not loaded yet

parent 1601acaa
Pipeline #23874 canceled with stage
in 1 minute and 6 seconds
......@@ -11,6 +11,8 @@ minerva (14.0.11) stable; urgency=medium
CellDesigner file minerva (#1203)
* Bug fix: author list inproperly presented author data when some fields were
missing (#1201)
* Bug fix: refreshing minerva page with more than one plugin opened might
led to an error due to race condition (#1197)
-- Piotr Gawron <piotr.gawron@uni.lu> Mon, 30 Mar 2020 10:00:00 +0200
......
......@@ -80,7 +80,7 @@ Plugin.prototype.setLoadedPluginData = function (loadedPluginData) {
/**
*
* @returns {UserPluginObject}
* @returns {?null|UserPluginObject}
*/
Plugin.prototype.getLoadedPluginData = function () {
return this._loadedPluginData;
......@@ -189,11 +189,15 @@ Plugin.prototype.load = function () {
Plugin.prototype.getMinWidth = function () {
var value;
var data = this.getLoadedPluginData();
if (data.minWidth !== undefined) {
if (typeof data.minWidth === "function") {
value = parseInt(data.minWidth());
} else {
value = parseInt(data.minWidth);
if (data === undefined || data === null) { //this can happen when plugin is added to list of plugins but data was not loaded yet
logger.warn("[" + this.getName() + "] Plugin data not available. ");
} else {
if (data.minWidth !== undefined) {
if (typeof data.minWidth === "function") {
value = parseInt(data.minWidth());
} else {
value = parseInt(data.minWidth);
}
}
}
return value;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment