Skip to content

Unexpected error with message Cannot read properties of null (reading 'length') #4826

Closed

Description

@easyhooon

Description

Unexpected renderer process error.

Minimal Reprouducible Markdown Example (or Steps)

Stack Trace

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)

Activity

  1. Jocs commented on Jul 4, 2026

    @Jocs
    Member

    Thanks for the report!

    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.

    Fixes (both landed after beta.5):

    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.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions