Skip to content

eva-summary.xsl: guard against division by zero when ac or pv is zero#709

Merged
yegor256 merged 1 commit into
zerocracy:masterfrom
VasilevNStas:685-eva-summary-zero-div
Jul 13, 2026
Merged

eva-summary.xsl: guard against division by zero when ac or pv is zero#709
yegor256 merged 1 commit into
zerocracy:masterfrom
VasilevNStas:685-eva-summary-zero-div

Conversation

@VasilevNStas

Copy link
Copy Markdown
Contributor

Fixes #685

Added and xs:double(ac) != 0 and xs:double(pv) != 0 to the template match predicate. Without this guard, ev div ac or ev div pv produces INF in XPath 2.0 when the divisor is zero, which crashes format-number() in z:format-signed.

When ac or pv is zero, the template no longer matches and falls through to the low-priority fallback template ("Not enough data..."), which is a safe degradation.

@VasilevNStas

Copy link
Copy Markdown
Contributor Author

@yegor256 plz review

@yegor256 yegor256 merged commit 6de8c05 into zerocracy:master Jul 13, 2026
16 checks passed
@0crat

0crat commented Jul 14, 2026

Copy link
Copy Markdown

@VasilevNStas Thanks for the contribution! You've earned +20 points for this: +24 as a basis; -4 for too few (2) hits-of-code. Please, keep them coming. Your running score is +3000; don't forget to check your Zerocracy account too).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

eva-summary.xsl crashes on division by zero when ac or pv equals zero

3 participants