You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unexpected error with message Cannot read properties of null (reading 'length') #4826
TypeError: Cannot read properties of null (reading 'length')
at History._record (file:///Applications/marktext.app/Contents/Resources/app.asar/out/renderer/assets/index-D8_UerJB.js:147405:13)
at file:///Applications/marktext.app/Contents/Resources/app.asar/out/renderer/assets/index-D8_UerJB.js:147281:16
at file:///Applications/marktext.app/Contents/Resources/app.asar/out/renderer/assets/index-D8_UerJB.js:149993:9
at Array.forEach (<anonymous>)
at EventCenter.emit (file:///Applications/marktext.app/Contents/Resources/app.asar/out/renderer/assets/index-D8_UerJB.js:149992:29)
at JSONState._flushOperationCache (file:///Applications/marktext.app/Contents/Resources/app.asar/out/renderer/assets/index-D8_UerJB.js:147224:28)
at file:///Applications/marktext.app/Contents/Resources/app.asar/out/renderer/assets/index-D8_UerJB.js:147201:12
Version
MarkText: v0.20.0-beta.5
Operating system: Darwin arm64 25.2.0 (darwin)
This crash (Cannot read properties of null (reading 'length') at History._record, reached through JSONState._flushOperationCache → json-change emit) is already fixed on develop, after the v0.20.0-beta.5 build you hit it on.
Root cause: ot-json1.compose() legitimately returns the identity operation (null) when a frame's queued ops cancel each other out (e.g. during IME composition). _flushOperationCache assumed a non-empty batch always composes to a non-null op and emitted it through json-change; History's listener passed it to _record, which reads op.length and threw on null.
Activity
Jocs commentedon Jul 4, 2026
Thanks for the report!
This crash (
Cannot read properties of null (reading 'length')atHistory._record, reached throughJSONState._flushOperationCache→json-changeemit) is already fixed ondevelop, after the v0.20.0-beta.5 build you hit it on.Root cause:
ot-json1.compose()legitimately returns the identity operation (null) when a frame's queued ops cancel each other out (e.g. during IME composition)._flushOperationCacheassumed a non-empty batch always composes to a non-null op and emitted it throughjson-change;History's listener passed it to_record, which readsop.lengthand threw onnull.Fixes (both landed after beta.5):
_flushOperationCacheno longer emitsjson-changefor an identity (null) op.History'sjson-changelistener now ignores identity ops (defense-in-depth; also covers theupdateContents(null)dispatch path), with a regression test (identityOpJsonChange.spec.ts).This will be in the next 0.20.0 beta after beta.5. Closing as resolved. If you can still reproduce on a build newer than beta.5, please reopen.