dome icon indicating copy to clipboard operation
dome copied to clipboard

Silent crash with invalid string

Open Deijin27 opened this issue 1 year ago • 1 comments

I was getting a crash in dome where there was no error dialog and nothing in the log, the window just didn't open.

After adding many debug log messages I managed to track it down to me having accidentally passed an image file to some string manipulation code.

Recreation in dome:

// load image as text
var text = FileSystem.load("background.png")
Log.info("before") // this log message DOES appear in the dome log
var newText = text.replace("\r", "")
Log.info("after") // this log message DOES NOT appear in the dome log

This actual error occurred in my xml library, so I tested with wren_cli, but the error did not occur.

In wren_cli:

var text = File.read("background.png")
System.print("before")
var newText = text.replace("\r", "")
System.print("after") // this log message DOES appear in the console
// ... then it goes on to abort as usual in wren because it's an invalid xml document

For reference, I'm using dome 1.8.2 on Windows and this is the image I was doing this with: https://github.com/Deijin27/wren-xsequence/blob/master/test_data/test_image.png

Deijin27 avatar Nov 15 '23 21:11 Deijin27