throw an exception if not even a default joystick could be found;
This can only happen if $FG_ROOT is corrupted or some developer has broken the default js config. Better not keep that under the rug.
This commit is contained in:
parent
325d545132
commit
4a1eadbf35
1 changed files with 5 additions and 9 deletions
|
@ -438,7 +438,7 @@ FGInput::_init_joystick ()
|
|||
int js_named_index = 1000;
|
||||
_scan_joystick_dir(&path, js_nodes, &js_named_index);
|
||||
|
||||
// build name->node map for each <name> (reverse order)
|
||||
// build name->node map with each <name> (reverse order)
|
||||
map<string, SGPropertyNode_ptr> jsmap;
|
||||
vector<SGPropertyNode_ptr> js_named = js_nodes->getChildren("js-named");
|
||||
|
||||
|
@ -469,20 +469,16 @@ FGInput::_init_joystick ()
|
|||
SGPropertyNode_ptr named;
|
||||
|
||||
if ((named = jsmap[name])) {
|
||||
string source = named->getStringValue("source", "");
|
||||
if (source.empty())
|
||||
SG_LOG(SG_INPUT, SG_INFO, "... found joystick (user defined)");
|
||||
else
|
||||
SG_LOG(SG_INPUT, SG_INFO, "... found joystick: \"" << source << '"');
|
||||
string source = named->getStringValue("source", "user defined");
|
||||
SG_LOG(SG_INPUT, SG_INFO, "... found joystick: \"" << source << '"');
|
||||
|
||||
} else if ((named = jsmap["default"])) {
|
||||
string source = named->getStringValue("source", "");
|
||||
string source = named->getStringValue("source", "user defined");
|
||||
SG_LOG(SG_INPUT, SG_INFO, "No config found for joystick \"" << name
|
||||
<< "\"\nUsing default: \"" << source << '"');
|
||||
|
||||
} else {
|
||||
SG_LOG(SG_INPUT, SG_ALERT, "No default joystick found! (<name>default</name>)");
|
||||
continue;
|
||||
throw sg_throwable(string("No default joystick found! (<name>default</name>)"));
|
||||
}
|
||||
|
||||
js_node = js_nodes->getChild("js", i, true);
|
||||
|
|
Loading…
Reference in a new issue