mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
statistics: don't reset binner if binner is set
Recently code was added to reset variable 1 binner if the second variable does not support an unbinned first variable. It forgot to check whether a binner was already set. Do this. But validate the old binner first! This code is extremely fragile and will have to be redone. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
77bc0c7c93
commit
6a6dd0888a
1 changed files with 3 additions and 2 deletions
|
@ -557,9 +557,11 @@ void StatsState::validate(bool varChanged)
|
|||
if (var1 == var2)
|
||||
var2 = nullptr;
|
||||
|
||||
validateBinner(var1Binner, var1, false);
|
||||
|
||||
// If there is no second variable or the second variable is not
|
||||
// "numeric", the first variable must be binned.
|
||||
if (!var2 || var2->type() != StatsVariable::Type::Numeric)
|
||||
if ((!var2 || var2->type() != StatsVariable::Type::Numeric) && !var1Binner)
|
||||
var1Binner = getFirstBinner(var1);
|
||||
|
||||
// Check that the binners and operation are valid
|
||||
|
@ -567,7 +569,6 @@ void StatsState::validate(bool varChanged)
|
|||
var2Binner = nullptr; // Second variable can only be binned if first variable is binned.
|
||||
var2Operation = StatsOperation::Invalid;
|
||||
}
|
||||
validateBinner(var1Binner, var1, false);
|
||||
validateBinner(var2Binner, var2, true);
|
||||
validateOperation(var2Operation, var2, var1Binner);
|
||||
|
||||
|
|
Loading…
Reference in a new issue