Don't crash on prompt cancel.

This commit is contained in:
Brian Geppert
2014-12-07 19:19:35 -06:00
parent 1d3cf36ba5
commit 713397b008

View File

@@ -253,6 +253,9 @@ Blockly.FieldTextInput.prototype.widgetDispose_ = function() {
* @return {?string} A string representing a valid number, or null if invalid.
*/
Blockly.FieldTextInput.numberValidator = function(text) {
if(text === null) {
return null;
}
// TODO: Handle cases like 'ten', '1.203,14', etc.
// 'O' is sometimes mistaken for '0' by inexperienced users.
text = text.replace(/O/ig, '0');