From 6f044e1cd31994566d85af097ad2dea81db3a4ba Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 9 Mar 2016 17:36:04 -0800 Subject: [PATCH] handling for leading slashes while loading mappings --- .../script-engine/src/AssetMappingsScriptingInterface.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libraries/script-engine/src/AssetMappingsScriptingInterface.cpp b/libraries/script-engine/src/AssetMappingsScriptingInterface.cpp index 85ac84c244..3f2dd84721 100644 --- a/libraries/script-engine/src/AssetMappingsScriptingInterface.cpp +++ b/libraries/script-engine/src/AssetMappingsScriptingInterface.cpp @@ -137,12 +137,13 @@ void AssetMappingModel::refresh() { existingPaths.removeOne(mapping.first); - QString fullPath = ""; + QString fullPath = "/"; QStandardItem* lastItem = nullptr; - for (int i = 0; i < length; ++i) { - fullPath += (i == 0 ? "" : "/") + parts[i]; + // start index at 1 to avoid empty string from leading slash + for (int i = 1; i < length; ++i) { + fullPath += (i == 1 ? "" : "/") + parts[i]; auto it = _pathToItemMap.find(fullPath); if (it == _pathToItemMap.end()) {