From a21be51e73ee74152000e31b659dd2550122b43e Mon Sep 17 00:00:00 2001 From: cxl Date: Thu, 16 Jul 2015 06:49:05 +0000 Subject: [PATCH] ide: Empty builder issue crash fix refactored #1186 git-svn-id: svn://ultimatepp.org/upp/trunk@8688 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/ide/Methods.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/uppsrc/ide/Methods.cpp b/uppsrc/ide/Methods.cpp index 3b4d05c95..10414e5b9 100644 --- a/uppsrc/ide/Methods.cpp +++ b/uppsrc/ide/Methods.cpp @@ -445,9 +445,7 @@ void BuildMethods::Load() VectorMap map; String fn = ConfigFile(ff.GetName()); if(LoadVarFile(fn, map)) { - int builderIdx = map.Find("BUILDER"); - String builderName = builderIdx >= 0 ? map[builderIdx] : ""; - + String builderName = map.Get("BUILDER", Null); int setupIdx = -1; String prefix; for(int i = 0; i < setups.GetCount(); i++) { @@ -499,7 +497,7 @@ bool BuildMethods::Save() VectorMap map; for(int j = 1; j < method.GetIndexCount(); j++) map.Add(method.GetId(j).ToString(), method.Get(i, j)); - if(map.Get("BUILDER", "") != "SCRIPT") + if(map.Get("BUILDER", Null) != "SCRIPT") map.RemoveKey("SCRIPT"); map = SieveBuilderVars(map); @@ -616,7 +614,7 @@ VectorMap BuildMethods::SieveBuilderVars(const VectorMap sievedMap; - String builder = map.Get("BUILDER"); + String builder = map.Get("BUILDER", Null); if(builder.IsEmpty()) return VectorMap(); @@ -648,9 +646,8 @@ VectorMap BuildMethods::MapBuilderVars(const VectorMap mapedMap; Index varsToMaped; - - int builderIdx = map.Find("BUILDER"); - String builder = builderIdx >= 0 ? map[builderIdx] : ""; + + String builder = map.Get("BUILDER", Null); if(builder.IsEmpty()) return VectorMap();