Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property 'type' of null when render Button with null value. #5472

Closed
blade254353074 opened this issue Mar 24, 2017 · 4 comments
Labels
馃悰 Bug Ant Design Team had proved that this is a bug. help wanted The suggestion or request has been accepted, we need you to help us by sending a pull request.

Comments

@blade254353074
Copy link
Contributor

blade254353074 commented Mar 24, 2017

Environment(required)

  • antd version: 2.8.2
  • OS and its version: macOS 10.11.6
  • Browser and its version: Chrome 57

What did you do? Please provide steps to re-produce your problem.

<Button>{null}馃檭</Button>

What do you expected?

Render the button (<button>馃檭</button>) without error.

What happen?

insertSpace method execute the express null.type.
Caused the type error:

Uncaught TypeError: Cannot read property 'type' of null
    at insertSpace (unpkg.com/antd@2.8.2/dist/antd-with-locales.js:88201)
    at mapSingleChildIntoContext (unpkg.com/react@15.4.2/dist/react.js:371)
    at traverseAllChildrenImpl (unpkg.com/react@15.4.2/dist/react.js:3390)
    at traverseAllChildrenImpl (unpkg.com/react@15.4.2/dist/react.js:3406)
    at traverseAllChildren (unpkg.com/react@15.4.2/dist/react.js:3485)
    at mapIntoWithKeyPrefixInternal (unpkg.com/react@15.4.2/dist/react.js:391)
    at Object.mapChildren [as map] (unpkg.com/react@15.4.2/dist/react.js:413)
    at Button.render (unpkg.com/antd@2.8.2/dist/antd-with-locales.js:88303)
    at unpkg.com/react-dom@15.4.2/dist/react-dom.js:5250
    at measureLifeCyclePerf (unpkg.com/react-dom@15.4.2/dist/react-dom.js:4529)

Re-producible online demo

http://codepen.io/blade254353074/pen/wJXgrL

@afc163
Copy link
Member

afc163 commented Mar 24, 2017

馃檭

Could you to help us to fix that?

@afc163 afc163 added 馃悰 Bug Ant Design Team had proved that this is a bug. help wanted The suggestion or request has been accepted, we need you to help us by sending a pull request. labels Mar 24, 2017
@blade254353074
Copy link
Contributor Author

Yeah, wait a minute.

@blade254353074
Copy link
Contributor Author

@afc163 Done.

afc163 pushed a commit that referenced this issue Mar 24, 2017
* Fix button render with null or undefined child.

Fix bug #5472

* Add missing semicolon

* Make if statement braced.

......
@afc163 afc163 closed this as completed Mar 24, 2017
benjycui pushed a commit that referenced this issue Mar 27, 2017
* Fix button render with null or undefined child.

Fix bug #5472

* Add missing semicolon

* Make if statement braced.

......
@lock
Copy link

lock bot commented May 1, 2018

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators May 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
馃悰 Bug Ant Design Team had proved that this is a bug. help wanted The suggestion or request has been accepted, we need you to help us by sending a pull request.
Projects
None yet
Development

No branches or pull requests

2 participants