laodouya opened a new pull request, #21707:
URL: https://github.com/apache/echarts/pull/21707

   ## Brief Information
   
   This pull request is in the type of:
   
   - [x] 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
   
   - #21706: [Bug] Geo/map chart crashes with "Cannot read properties of null 
(reading '0')" when chart size is 0×0 (regression in 6.1.0)
   
   
   ## 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.
   
   - [x] 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
   
   - [x] Please squash the commits into a single one when merging.
   
   ### Other information
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to