Skip to content
This repository
Browse code

fix parseInt of '0'

  • Loading branch information...
commit a16fb0dcb7dc001646ffd792e47bfa46c875d0a1 1 parent 7cf24cb
Alon Zakai authored

Showing 1 changed file with 3 additions and 2 deletions. Show diff stats Hide diff stats

  1. +3 2 src/library.js
5 src/library.js
@@ -3852,6 +3852,7 @@ LibraryManager.library = {
3852 3852 }
3853 3853
3854 3854 // Find base.
  3855 + var ok = false;
3855 3856 var finalBase = base;
3856 3857 if (!finalBase) {
3857 3858 if ({{{ makeGetValue('str', 0, 'i8') }}} == '0'.charCodeAt(0)) {
@@ -3862,6 +3863,7 @@ LibraryManager.library = {
3862 3863 } else {
3863 3864 finalBase = 8;
3864 3865 str++;
  3866 + ok = true; // we saw an initial zero, perhaps the entire thing is just "0"
3865 3867 }
3866 3868 }
3867 3869 }
@@ -3869,14 +3871,13 @@ LibraryManager.library = {
3869 3871
3870 3872 // Get digits.
3871 3873 var chr;
3872   - var ok = false;
3873 3874 while ((chr = {{{ makeGetValue('str', 0, 'i8') }}}) != 0) {
3874 3875 var digit = parseInt(String.fromCharCode(chr), finalBase);
3875 3876 if (isNaN(digit)) {
3876 3877 break;
3877 3878 } else {
3878   - ok = true;
3879 3879 str++;
  3880 + ok = true;
3880 3881 }
3881 3882 }
3882 3883 if (!ok) {

0 comments on commit a16fb0d

Please sign in to comment.
Something went wrong with that request. Please try again.