Skip to content

Crash on Euro symbol (€) #43

@callumnewlands

Description

@callumnewlands

Expected Behavior

The <MathComponent/> should not crash when any symbols are passed to it.

Current Behavior

When the <MathComponent/> is passed a euro symbol the application crashes with the error:

TypeError: Cannot read properties of null (reading '4')
    at Object.Other [as item] (BaseConfiguration.ts:64:1)
    at SubHandler.parse (MapHandler.ts:108:1)
    at TexParser.parse (TexParser.ts:137:1)
    at TexParser.Parse (TexParser.ts:186:1)
    at new TexParser (TexParser.ts:89:1)
    at TeX.compile (tex.ts:186:1)
    at AbstractMathItem.compile (MathItem.ts:365:1)
    at Object.renderMath (MathDocument.ts:167:1)
    at RenderList.renderConvert (MathDocument.ts:211:1)
    at AbstractMathItem.convert 

And then the following error which I believe is due to it trying to render an error message as a child component (though I could be wrong on that)

Objects are not valid as a React child (found: [object Error]). If you meant to render a collection of children, use an array instead.

Steps to Reproduce

  1. Go to https://charliemcvicker.github.io/mathjax-react/
  2. In the 'Live Typing' example, paste the symbol (May also happen with other symbols although I am yet to find any such ones)
  3. The site will crash and the above error is shown in the browser console

Context (Environment)

Happens in (at least) both Chrome and Firefox. My use case is trying to display currency-based maths questions with currency symbols (£, $, and ¥ all work fine so I'm not sure what's different about the symbol)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions