Fix graphing crash when plotting equations with errors (#958)

* fix crash

* Fix follow up crash

* real fix
This commit is contained in:
Pepe Rivera 2020-01-22 13:39:51 -08:00 committed by GitHub
parent e77823b97c
commit 350b8a9024
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -162,14 +162,11 @@ namespace GraphControl
void Grapher::OnEquationChanged(Equation ^ equation)
{
// If the equation was previously valid, we should try to graph again in the event of the failure
bool shouldRetry = equation->IsValidated;
// Reset these properties if the equation is requesting to be graphed again
equation->HasGraphError = false;
equation->IsValidated = false;
TryPlotGraph(false, shouldRetry);
TryPlotGraph(false, true);
}
void Grapher::OnEquationStyleChanged(Equation ^)
@ -321,7 +318,7 @@ namespace GraphControl
// Do not re-initialize the graph to empty if there are still valid equations graphed
if (!shouldKeepPreviousGraph)
{
initResult = TryInitializeGraph(keepCurrentView, graphExpression.get());
initResult = m_graph->TryInitialize();
if (initResult != nullopt)
{
UpdateGraphOptions(m_graph->GetOptions(), validEqs);