1
0
Fork 0

src/Viewer/ViewPropertyEvaluator.cxx: fix getSequenceDoubleValue()'s handling of default value.

If node's string value is '' then return <default_> - used to return 0.0 which
is incorrect.
This commit is contained in:
Julian Smith 2020-02-29 14:40:35 +00:00
parent a3d75e8573
commit 1e07dab5c5

View file

@ -488,7 +488,12 @@ namespace ViewPropertyEvaluator {
{ {
SGPropertyNode* node = getSequenceNode(sequence); SGPropertyNode* node = getSequenceNode(sequence);
if (node) { if (node) {
return node->getDoubleValue(); if (node->getStringValue()[0] != 0) {
return node->getDoubleValue();
}
/* If we reach here, the node exists but its value is an empty
string, so node->getDoubleValue() would return 0 which isn't
useful, so instead we return default_. */
} }
return default_; return default_;
} }