Fix --leap assumption that LeapCommand setting is ALWAYS an array.

Nuance of command-line processing: when there's exactly one --leap switch, the
resulting LLSD is a scalar string rather than an array with one entry. Fix
processing code to handle either case.
master
Nat Goodspeed 2012-03-14 23:59:57 -04:00
parent cb38ceb89f
commit 7de3161fa8
1 changed files with 14 additions and 3 deletions

View File

@ -1041,10 +1041,21 @@ bool LLAppViewer::init()
gGLActive = FALSE;
// Iterate over --leap command-line options
BOOST_FOREACH(const std::string& leap, llsd::inArray(gSavedSettings.getLLSD("LeapCommand")))
// Iterate over --leap command-line options. But this is a bit tricky: if
// there's only one, it won't be an array at all.
LLSD LeapCommand(gSavedSettings.getLLSD("LeapCommand"));
LL_DEBUGS("InitInfo") << "LeapCommand: " << LeapCommand << LL_ENDL;
if (LeapCommand.isDefined() && ! LeapCommand.isArray())
{
LL_DEBUGS("InitInfo") << "processing --leap \"" << leap << '"' << LL_ENDL;
// If LeapCommand is actually a scalar value, make an array of it.
// Have to do it in two steps because LeapCommand.append(LeapCommand)
// trashes content! :-P
LLSD item(LeapCommand);
LeapCommand.append(item);
}
BOOST_FOREACH(const std::string& leap, llsd::inArray(LeapCommand))
{
LL_INFOS("InitInfo") << "processing --leap \"" << leap << '"' << LL_ENDL;
// We don't have any better description of this plugin than the
// user-specified command line. Passing "" causes LLLeap to derive a
// description from the command line itself.