When a textbox gets a return value that is empty/empty string, the app crashes.
You have to use a workaround. The app will crash or in the companion it warns with an 'undefined' warning when getting an empty string as value.
The workaround is to test on 'is empty'. In this case 'data' is the return value of an extension and it returned "" (empty string).
Workaround
The label has no problem with an empty return string.
It happens both in the Companion app and in the apk.
Debugging is possible but I found the Textbox bug already.
It is a string for sure, which is returned, because the password is empty
if ( password == null || data == null || password.isEmpty() || data.isEmpty() || aesKeySize <= 0) {
// If any of the parameters is empty or aesKeySize is not valid, return an empty string
return "";
It is an empty string. And the Label has no problem at all with the same result.
In all textboxes I use the workaround by testing with string function 'is empty'.
Try it without the workaround to cause an error. AESGCM_V1.0.4.aia (632.1 KB)
What is the actual value of data in this case? I also cannot replicate by passing an empty string to the textbox. If when you are saying empty, you mean null, App Inventor's design is that you should never return a null to the blocks level. If the extension is returning null then it is violating App Inventor's design constraints and the behavior is undefined.
On a closer look into the blocks, the problem seems to be with the extension, not related to the internal components. I believe the extension is trying to dispatch events on async threads (where you cannot touch UI)
It returns an empty string in Java, from the extension, not null.
if ( password == null || data == null || password.isEmpty() || data.isEmpty() || aesKeySize <= 0) {
// If any of the parameters is empty or aesKeySize is not valid, return an empty string
return "";
}