close
Skip to content

fix(geo): tolerate singular view transform when chart size is zero - #21707

Merged
plainheart merged 2 commits into
apache:releasefrom
laodouya:fix-geo-zero-size-invert-null
Jul 26, 2026
Merged

fix(geo): tolerate singular view transform when chart size is zero#21707
plainheart merged 2 commits into
apache:releasefrom
laodouya:fix-geo-zero-size-invert-null

Conversation

@laodouya

Copy link
Copy Markdown

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

Fixes the TypeError: Cannot read properties of null (reading '0') thrown by every geo/map chart whose size is 0×0 (e.g. a container hidden with display: none) — a regression introduced in 6.1.0.

Fixed issues

Details

Before: What was the problem?

With a zero-sized view rect the overall view transform has zero scale, so its determinant is 0 and zrender's matrix.invert() returns null without writing out. viewCoordSysUpdateOverallTrans passed that return value to legacyCopyOverallTrans unguarded, where matrixCopy(target.invTransform, null) dereferences null[0].

Before 6.1.0, the equivalent code (View.prototype._updateTransform) ignored invert()'s return value — invTransform simply kept its previous contents — so zero-sized geo charts were tolerated. Since the failure happens inside the update pipeline, in real apps it re-throws on every animation frame until the chart is disposed.

After: How does it behave after the fixing?

legacyCopyOverallTrans skips the inverse copy when matrixInvert returned null, keeping the last inverse — the same semantics as before 6.1.0 (and the same as the existing matrixInvert(viewInner.mtRawInv, mtRaw) call in this file, whose return value is likewise ignored). Zero-sized geo/map charts render without throwing; a regression unit test is included (fails before the fix, passes after).

Document Info

One of the following should be checked.

  • This PR doesn't relate to document changes
  • The document should be updated later
  • The document changes have been made in apache/echarts-doc#xxx

Misc

Security Checking

  • This PR uses security-sensitive Web APIs.

ZRender Changes

  • This PR depends on ZRender changes (ecomfe/zrender#xxx).

Related test cases or examples to use the new APIs

N.A.

Merging options

  • Please squash the commits into a single one when merging.

Other information

@echarts-bot

echarts-bot Bot commented Jul 24, 2026

Copy link
Copy Markdown

Thanks for your contribution!
The community will review it ASAP. In the meanwhile, please checkout the coding standard and Wiki about How to make a pull request.

Please DO NOT commit the files in dist, i18n, and ssr/client/dist folders in a non-release pull request. These folders are for release use only.

@plainheart
plainheart force-pushed the fix-geo-zero-size-invert-null branch from 6381d33 to 1ec3462 Compare July 26, 2026 07:05
@plainheart
plainheart changed the base branch from master to release July 26, 2026 07:06
@plainheart plainheart added this to the 6.1.1 milestone Jul 26, 2026
@plainheart
plainheart merged commit 9faba8a into apache:release Jul 26, 2026
2 checks passed
@echarts-bot

echarts-bot Bot commented Jul 26, 2026

Copy link
Copy Markdown

Congratulations! Your PR has been merged. Thanks for your contribution! 👍

@laodouya
laodouya deleted the fix-geo-zero-size-invert-null branch July 26, 2026 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Geo/map chart crashes with "Cannot read properties of null (reading '0')" when chart size is 0×0 (regression in 6.1.0)

2 participants