You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2019/11/29 06:07:01 UTC

[royale-asjs] branch develop updated: Restrict bead wasn't handling null correct. Should fix #594

This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new 333e0e2  Restrict bead wasn't handling null correct.  Should fix #594
333e0e2 is described below

commit 333e0e24da5757927e74b9a9a58bd935b558ccc8
Author: Alex Harui <ah...@apache.org>
AuthorDate: Thu Nov 28 22:06:38 2019 -0800

    Restrict bead wasn't handling null correct.  Should fix #594
---
 .../royale/html/accessories/RestrictTextInputBead.as      | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/accessories/RestrictTextInputBead.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/accessories/RestrictTextInputBead.as
index f37b6c2..c88e5c5 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/accessories/RestrictTextInputBead.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/accessories/RestrictTextInputBead.as
@@ -144,12 +144,15 @@ package org.apache.royale.html.accessories
 			
 			var key:String = String.fromCharCode(code);
 			
-			var regex:RegExp = new RegExp("[" + restrict + "]");
-			if (!regex.test(key)) {
-				event["returnValue"] = false;
-				if (event.preventDefault) event.preventDefault();
-				return;
-			}
+            if (restrict)
+            {
+    			var regex:RegExp = new RegExp("[" + restrict + "]");
+    			if (!regex.test(key)) {
+    				event["returnValue"] = false;
+    				if (event.preventDefault) event.preventDefault();
+    				return;
+    			}
+            }
 		}
 	}
 }