From c6bf09f509881cb988365b73048ea6acc9c94624 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Mon, 13 Oct 2014 08:35:52 -0700 Subject: [PATCH] Fix model uploading for the case that haven't uploaded model before --- examples/editModels.js | 1 - examples/newEditEntities.js | 1 - interface/src/scripting/SettingsScriptingInterface.cpp | 6 ++++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/examples/editModels.js b/examples/editModels.js index 2741bdccdd..0a908595a3 100644 --- a/examples/editModels.js +++ b/examples/editModels.js @@ -1312,7 +1312,6 @@ var toolBar = (function () { if (clickedOverlay === loadFileMenuItem) { toggleNewModelButton(false); - // TODO BUG: this is bug, if the user has never uploaded a model, this will throw an JS exception file = Window.browse("Select your model file ...", Settings.getValue("LastModelUploadLocation").path(), "Model files (*.fst *.fbx)"); diff --git a/examples/newEditEntities.js b/examples/newEditEntities.js index b753537631..49dd46033b 100644 --- a/examples/newEditEntities.js +++ b/examples/newEditEntities.js @@ -238,7 +238,6 @@ var toolBar = (function () { if (clickedOverlay === loadFileMenuItem) { toggleNewModelButton(false); - // TODO BUG: this is bug, if the user has never uploaded a model, this will throw an JS exception file = Window.browse("Select your model file ...", Settings.getValue("LastModelUploadLocation").path(), "Model files (*.fst *.fbx)"); diff --git a/interface/src/scripting/SettingsScriptingInterface.cpp b/interface/src/scripting/SettingsScriptingInterface.cpp index ea9d645a94..21a5244138 100644 --- a/interface/src/scripting/SettingsScriptingInterface.cpp +++ b/interface/src/scripting/SettingsScriptingInterface.cpp @@ -22,6 +22,9 @@ QVariant SettingsScriptingInterface::getValue(const QString& setting) { QSettings* settings = Application::getInstance()->lockSettings(); QVariant value = settings->value(setting); Application::getInstance()->unlockSettings(); + if (!value.isValid()) { + value = ""; + } return value; } @@ -29,6 +32,9 @@ QVariant SettingsScriptingInterface::getValue(const QString& setting, const QVar QSettings* settings = Application::getInstance()->lockSettings(); QVariant value = settings->value(setting, defaultValue); Application::getInstance()->unlockSettings(); + if (!value.isValid()) { + value = ""; + } return value; }