deepnight / ldtk

Modern, lightweight and efficient 2D level editor
https://ldtk.io
MIT License
3.44k stars 192 forks source link

Escaping Charactors in entities corrupts LDtk file | Cannot read properties of null (reading 'externalLevels') #1087

Open GuvBubbs opened 7 months ago

GuvBubbs commented 7 months ago

In our game ⁠☄Comet we use \f = Line break & \n = Page brake / carriage return

This works find most of time but sometimes LDtk just wants to fuck our shit up and turn them into broken characters. image Often resulting in an error that prevents us from opening the project image

Other times it seems to add extra slashes then later removes them again, leading to the same error. image

I have a file that works the first time you open it, but once saving it (Without making any edits) it was brake. I will DM this to you.

Stack:

LDtk version: 1.5.3-64bits
Cannot read properties of null (reading 'externalLevels')
TypeError
TypeError: Cannot read properties of null (reading 'externalLevels')
    at Object.cb (file:///C:/Users/Guv_Bubbs/AppData/Local/Programs/ldtk/resources/app.asar/assets/js/renderer.js:285488:8)
    at ui_modal_Progress.update (file:///C:/Users/Guv_Bubbs/AppData/Local/Programs/ldtk/resources/app.asar/assets/js/renderer.js:292554:8)
    at dn_Process._doMainUpdate (file:///C:/Users/Guv_Bubbs/AppData/Local/Programs/ldtk/resources/app.asar/assets/js/renderer.js:405:4)
    at dn_Process.updateAll (file:///C:/Users/Guv_Bubbs/AppData/Local/Programs/ldtk/resources/app.asar/assets/js/renderer.js:675:14)
    at Boot.update (file:///C:/Users/Guv_Bubbs/AppData/Local/Programs/ldtk/resources/app.asar/assets/js/renderer.js:5190:14)
    at Boot.mainLoop (file:///C:/Users/Guv_Bubbs/AppData/Local/Programs/ldtk/resources/app.asar/assets/js/renderer.js:5152:8)
    at hxd_System.browserLoop (file:///C:/Users/Guv_Bubbs/AppData/Local/Programs/ldtk/resources/app.asar/assets/js/renderer.js:190796:14)

Processes:

#0 App
 |--- #2 page.Home
 |--- #4 page.Home
#1 ui.modal.Progress
#3 ui.modal.dialog.LogPrint
#5 ui.modal.dialog.LogPrint

Log:


[BOOT]         App started
[BOOT]         Version: 1.5.3-64bits (build 473703)
[BOOT]         ExePath: C:/Users/Guv_Bubbs/AppData/Local/Programs/ldtk
[BOOT]         Assets: C:/Users/Guv_Bubbs/AppData/Local/Programs/ldtk/resources/app.asar/assets
[BOOT]         ExtraFiles: C:/Users/Guv_Bubbs/AppData/Local/Programs/ldtk/extraFiles
[BOOT]         CWD: C:\Users\Guv_Bubbs\AppData\Local\Programs\ldtk\
[BOOT]         Display: 2560x1440
[BOOT]         Args: soloValues=[], args=[]
[FILE]         Loading settings from C:/Users/Guv_Bubbs/AppData/Roaming/LDtk/settings...
[BOOT]         AppZoomFactor: 1
[BOOT]         Calling appReady...
[UPDATE]       Looking for update
[BOOT]         Start args: path=null levelIndex=null
[BOOT]         Re-opening last project (C:/Playdate Dev/Comet SDK/Comet/source/levels/Comet.ldtk)...
[GENERAL]      Progress created.
[GENERAL]      Progress started: : "Comet.ldtk: Project...", 5 operation(s)
[LOAD]         Loading project Comet.ldtk...
[ERROR]        SyntaxError: Bad control character in string literal in JSON at position 6072063
[ERROR]        Failed to load project: C:/Playdate Dev/Comet SDK/Comet/source/levels/Comet.ldtk levelIdx=undefined
[GENERAL]      Page started: page.Home()
[FILE]         Loading page template: home from C:/Users/Guv_Bubbs/AppData/Local/Programs/ldtk/resources/app.asar/assets/tpl/pages/home.html
[DEBUG]        samplesDir=C:/Users/Guv_Bubbs/AppData/Local/Programs/ldtk/extraFiles/samples
[FILE]         Loading HTML template logPrint
[ERROR]        TypeError: Cannot read properties of null (reading 'iid')
[ERROR]        Failed to load project: C:/Playdate Dev/Comet SDK/Comet/source/levels/Comet.ldtk levelIdx=undefined
[GENERAL]      Page started: page.Home()
[FILE]         Loading page template: home from C:/Users/Guv_Bubbs/AppData/Local/Programs/ldtk/resources/app.asar/assets/tpl/pages/home.html
[DEBUG]        samplesDir=C:/Users/Guv_Bubbs/AppData/Local/Programs/ldtk/extraFiles/samples
[FILE]         Reading HTML template logPrint from cache
[GENERAL]      Page started: page.CrashReport()
[FILE]         Loading page template: crashReport from C:/Users/Guv_Bubbs/AppData/Local/Programs/ldtk/resources/app.asar/assets/tpl/pages/crashReport.html
[ERROR]        Cannot read properties of null (reading 'externalLevels') (TypeError)
[ERROR]        TypeError: Cannot read properties of null (reading 'externalLevels')
    at Object.cb (file:///C:/Users/Guv_Bubbs/AppData/Local/Programs/ldtk/resources/app.asar/assets/js/renderer.js:285488:8)
    at ui_modal_Progress.update (file:///C:/Users/Guv_Bubbs/AppData/Local/Programs/ldtk/resources/app.asar/assets/js/renderer.js:292554:8)
    at dn_Process._doMainUpdate (file:///C:/Users/Guv_Bubbs/AppData/Local/Programs/ldtk/resources/app.asar/assets/js/renderer.js:405:4)
    at dn_Process.updateAll (file:///C:/Users/Guv_Bubbs/AppData/Local/Programs/ldtk/resources/app.asar/assets/js/renderer.js:675:14)
    at Boot.update (file:///C:/Users/Guv_Bubbs/AppData/Local/Programs/ldtk/resources/app.asar/assets/js/renderer.js:5190:14)
    at Boot.mainLoop (file:///C:/Users/Guv_Bubbs/AppData/Local/Programs/ldtk/resources/app.asar/assets/js/renderer.js:5152:8)
    at hxd_System.browserLoop (file:///C:/Users/Guv_Bubbs/AppData/Local/Programs/ldtk/resources/app.asar/assets/js/renderer.js:190796:14)

[GENERAL]      
#0 App
 |--- #2 page.Home
 |--- #4 page.Home
 |--- #6 page.CrashReport
#1 ui.modal.Progress
#3 ui.modal.dialog.LogPrint
#5 ui.modal.dialog.LogPrint
GuvBubbs commented 7 months ago

image

GuvBubbs commented 7 months ago

Editing the broken file in notepad++ shows these image

GuvBubbs commented 7 months ago

The LDtk braking character is saved in this file LDtk Braking Bastard.txt