Skip to content
Snippets Groups Projects
Commit 13f8cfd1 authored by andreykproductengine's avatar andreykproductengine
Browse files

SL-9954 Mac Viewer crashes if logcontrol-dev.xml is modified

parent e2442851
No related branches found
No related tags found
No related merge requests found
...@@ -382,15 +382,22 @@ namespace ...@@ -382,15 +382,22 @@ namespace
{ {
llifstream file(filename().c_str()); llifstream file(filename().c_str());
if (file.is_open()) if (!file.is_open())
{ {
LLSDSerialize::fromXML(configuration, file); LL_WARNS() << filename() << " failed to open file; not changing configuration" << LL_ENDL;
return false;
}
if (LLSDSerialize::fromXML(configuration, file) == LLSDParser::PARSE_FAILURE)
{
LL_WARNS() << filename() << " parcing error; not changing configuration" << LL_ENDL;
return false;
} }
if (configuration.isUndefined()) if (configuration.isUndefined() || !configuration.isMap() || configuration.emptyMap())
{ {
LL_WARNS() << filename() << " missing, ill-formed," LL_WARNS() << filename() << " missing, ill-formed, or simply undefined"
" or simply undefined; not changing configuration" " content; not changing configuration"
<< LL_ENDL; << LL_ENDL;
return false; return false;
} }
...@@ -856,19 +863,24 @@ namespace LLError ...@@ -856,19 +863,24 @@ namespace LLError
setEnabledLogTypesMask(config["enabled-log-types-mask"].asInteger()); setEnabledLogTypesMask(config["enabled-log-types-mask"].asInteger());
} }
LLSD sets = config["settings"]; if (config.has("settings") && config["settings"].isArray())
LLSD::array_const_iterator a, end; {
for (a = sets.beginArray(), end = sets.endArray(); a != end; ++a) LLSD sets = config["settings"];
{ LLSD::array_const_iterator a, end;
const LLSD& entry = *a; for (a = sets.beginArray(), end = sets.endArray(); a != end; ++a)
{
ELevel level = decodeLevel(entry["level"]); const LLSD& entry = *a;
if (entry.isMap() && !entry.emptyMap())
setLevels(s->mFunctionLevelMap, entry["functions"], level); {
setLevels(s->mClassLevelMap, entry["classes"], level); ELevel level = decodeLevel(entry["level"]);
setLevels(s->mFileLevelMap, entry["files"], level);
setLevels(s->mTagLevelMap, entry["tags"], level); setLevels(s->mFunctionLevelMap, entry["functions"], level);
} setLevels(s->mClassLevelMap, entry["classes"], level);
setLevels(s->mFileLevelMap, entry["files"], level);
setLevels(s->mTagLevelMap, entry["tags"], level);
}
}
}
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment