| Summary: | attempting to plot a non-existent equation crashes. | ||
|---|---|---|---|
| Product: | [Applications] kst | Reporter: | D. V. Wiebe <dvw> |
| Component: | general | Assignee: | kst |
| Status: | RESOLVED FIXED | ||
| Severity: | crash | ||
| Priority: | NOR | ||
| Version First Reported In: | 1.0.0 | ||
| Target Milestone: | --- | ||
| Platform: | unspecified | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
D. V. Wiebe
2004-12-03 21:20:33 UTC
CVS commit by staikos:
Don't crash on empty equation
BUG: 94351
M +6 -7 kstequation.cpp 1.16
--- kdeextragear-2/kst/kst/kstequation.cpp #1.15:1.16
@@ -177,5 +177,5 @@ KstObject::UpdateType KstEquation::updat
bool force = false;
- if (KstObject::checkUpdateCounter(update_counter)) {
+ if (!_pe || KstObject::checkUpdateCounter(update_counter)) {
return NO_CHANGE;
}
@@ -240,6 +240,6 @@ void KstEquation::setEquation(const QStr
yy_scan_string(_equation.latin1());
int rc = yyparse();
- if (rc == 0) {
_pe = static_cast<Equation::Node*>(ParsedEquation);
+ if (rc == 0 && _pe) {
Equation::Context ctx;
ctx.sampleCount = _ns;
@@ -248,5 +248,4 @@ void KstEquation::setEquation(const QStr
_pe->collectVectors(VectorsUsed);
_pe->update(-1, &ctx);
- ParsedEquation = 0L;
} else {
// Parse error
@@ -256,6 +255,6 @@ void KstEquation::setEquation(const QStr
}
delete (Equation::Node*)ParsedEquation;
- ParsedEquation = 0L;
}
+ ParsedEquation = 0L;
}
_isValid = _pe != 0L;
@@ -414,6 +413,6 @@ bool KstEquation::FillY(bool force) {
yy_scan_string(_equation.latin1());
int rc = yyparse();
- if (rc == 0) {
_pe = static_cast<Equation::Node*>(ParsedEquation);
+ if (_pe && rc == 0) {
Equation::FoldVisitor vis(&ctx, &_pe);
_pe->collectVectors(VectorsUsed);
|