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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught (in promise) TypeError: object null is not iterable ... at getCompilerVersion #16

Closed
2 tasks done
Tracked by #2
gpersoon opened this issue Sep 13, 2019 · 0 comments
Closed
2 tasks done
Tracked by #2

Comments

@gpersoon
Copy link
Contributor

gpersoon commented Sep 13, 2019

@todo

  • fix selected compiler version when pragma solidity statement is missing
  • fix error when pragma solidity... includes more than one whitespace after "pragma"

While testing the solution for #15 I noticed the following.
If the source code doesn't exactly contain the text "pragma solidity....;" then the following error is shown in the console:

Uncaught (in promise) TypeError: object null is not iterable (cannot read property Symbol(Symbol.iterator))
    at getCompilerVersion (bundle.js:36108)

and the source code isn't saved.

This is related to:

https://github.com/ethereum-play/editor-solidity/blob/master/src/node_modules/getCompilerVersion.js
var regex = /pragma solidity\s*([><=\^]*)\s*(\d+\.\d+\.\d+)?\s*([><=\^]*)\s*(\d+\.\d+\.\d+)?;/

So if you've made a typo, or even haven't added "pragma solidity ..;" (e.g. delete everything and start typing), then the source can be lost.
Also if you have two spaces between "pragma" and "solidity", the problem also occurs and the source doesn't compile:

"pragma  solidity ..;

(this can be solved be changing the regex)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants