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

Empty math parameter in TexImage crashes #2

Closed
carloshgsilva opened this issue Jul 30, 2020 · 2 comments
Closed

Empty math parameter in TexImage crashes #2

carloshgsilva opened this issue Jul 30, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@carloshgsilva
Copy link

Problem:
If the parameter math get an empty string it crashes and make the others TeXImage don't load.

Code:

TexImage('');

Console:

D/AMK     (30054): onReady called; thread=Thread[JavaBridge,7,main]
D/AMK     (30054): Executing JavaScript: setNoWrap(false); setWidth('333.42857142857144px'); setColor('rgba(0,0,0,0.8666666666666667)'); setFontSize('24.0px'); render('', true);
D/AMK     (30054): Taking snapshot of [0.0, 0.0, 0.0, 0.0], scaled to [0, 0, 0, 0]
W/System.err(30054): java.lang.IllegalArgumentException: width and height must be > 0
W/System.err(30054): 	at android.graphics.Bitmap.createBitmap(Bitmap.java:1033)
W/System.err(30054): 	at android.graphics.Bitmap.createBitmap(Bitmap.java:1000)
W/System.err(30054): 	at android.graphics.Bitmap.createBitmap(Bitmap.java:950)
W/System.err(30054): 	at android.graphics.Bitmap.createBitmap(Bitmap.java:911)
W/System.err(30054): 	at com.madlonkay.flutter_tex_js.TexRenderer.takeSnapshot(TexRenderer.kt:149)
W/System.err(30054): 	at android.os.MessageQueue.nativePollOnce(Native Method)
W/System.err(30054): 	at android.os.MessageQueue.next(MessageQueue.java:326)
W/System.err(30054): 	at android.os.Looper.loop(Looper.java:160)
W/System.err(30054): 	at android.os.HandlerThread.run(HandlerThread.java:65)
I/chromium(30054): [INFO:CONSOLE(54)] "Uncaught Error: Java exception was raised during method invocation", source: file:///android_asset/ (54)
@amake amake changed the title empty math parameter in TeXImage crashes Empty math parameter in TexImage crashes Jul 31, 2020
@amake amake added the bug Something isn't working label Jul 31, 2020
@amake amake closed this as completed in 5fe8292 Jul 31, 2020
@amake
Copy link
Owner

amake commented Jul 31, 2020

Thanks. I've addressed this by rendering a Text('') if the input is empty. I chose this because I imagine it's desirable for the TexImage to take up approximately one text line of height even if it's empty, for consistency with surrounding elements.

If you have something else in mind, please let me know.

@amake
Copy link
Owner

amake commented Jul 31, 2020

I just released 0.1.5 with the fix. Please let know if there are any further issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants