Opening a copied rule on a layer that doesn't have the int-grid value the rule requires casuses a crash
Issue
When you copy a rule from one layer to another layer, that doesn't have the same int-grid value, and then try and edit the layer, LDTK crashes.
Expectation
Either it shouldn't let you copy the rule, and tell you that the int-grid value doesn't exist
Or
When editing, it should tell you that the int grid value is not valid and make you need to select a valid int-grid value before you can save/confirm
Workaround
There is a workaround here which is to just go and edit the layer to add the int grid value, but if you encounter this when you haven't saved in a while(like I had lol) then you lose a bunch of work, so it'd be nice to avoid a situation where it crashes.
Details
I have a detail layer and a ground layer with rules
On my detail int grid layer I have Snow as an int(last slot)
In my rules I have a snow group that uses the snow int grid to display snow tiles:
On my ground int grid layer I don't have a snow int.
I was copying my rules to the ground layer so here I copied snow, even though the ground layer doesn't have the snow int.
Trying to edit the rule, in order to change the int from the snow int to another int grid value, causes the error.
Full report:
Stack:
LDtk version: 1.5.3-64bits
Cannot read properties of null (reading 'identifier')
TypeError
TypeError: Cannot read properties of null (reading 'identifier')
at ui_modal_dialog_RulesWizard.updateIntGridValue (file:///C:/Users/Snowdrama/AppData/Local/Programs/ldtk/resources/app.asar/assets/js/renderer.js:298006:17)
at ui_modal_dialog_RulesWizard.updateUI (file:///C:/Users/Snowdrama/AppData/Local/Programs/ldtk/resources/app.asar/assets/js/renderer.js:297888:8)
at new ui_modal_dialog_RulesWizard (file:///C:/Users/Snowdrama/AppData/Local/Programs/ldtk/resources/app.asar/assets/js/renderer.js:297664:7)
at ui_modal_panel_EditAllAutoLayerRules.doUseWizard (file:///C:/Users/Snowdrama/AppData/Local/Programs/ldtk/resources/app.asar/assets/js/renderer.js:300720:3)
at HTMLButtonElement.<anonymous> (file:///C:/Users/Snowdrama/AppData/Local/Programs/ldtk/resources/app.asar/assets/js/renderer.js:301029:12)
at HTMLButtonElement.dispatch (C:\Users\Snowdrama\AppData\Local\Programs\ldtk\resources\app.asar\assets\js\jquery.min.js:2:43064)
at v.handle (C:\Users\Snowdrama\AppData\Local\Programs\ldtk\resources\app.asar\assets\js\jquery.min.js:2:41048)
Processes:
#0 App
|--- #3 page.Editor
|--- #4 misc.FileWatcher
|--- #5 display.WorldRender
|--- #6 display.LevelRender
|--- #7 display.Camera
|--- #8 display.Rulers[--]
|--- #9 tool.SelectionTool[--]
|--- #10 tool.lt.DoNothing[--]
|--- #11 WorldTool
|--- #12 tool.PanView[--]
|--- #13 tool.lt.DoNothing [PAUSED][--]
|--- #15 tool.lt.IntGridTool [PAUSED][--]
|--- #33 tool.lt.IntGridTool[--]
|--- #40 ui.modal.panel.EditAllAutoLayerRules
|--- #44 ui.modal.dialog.RulesWizard
Log:
[RENDER] Rendering world bg...
[RENDER] Rendering world bg...
[RENDER] Rendering world bg...
[USERACTION] Closed panel #16 ui.modal.panel.EditAllAutoLayerRules
[RENDER] Rendering world bg...
[RENDER] Rendering world bg...
[RENDER] Rendering world bg...
[RENDER] Rendering world bg...
[USERACTION] Opened panel #27 ui.modal.panel.EditAllAutoLayerRules
[FILE] Reading HTML template editAllAutoLayerRules from cache
[RENDER] Rendering world bg...
[RENDER] Rendering world bg...
[USERACTION] Closed panel #27 ui.modal.panel.EditAllAutoLayerRules
[RENDER] Rendering world bg...
[USERACTION] Opened panel #31 ui.modal.panel.EditLayerDefs
[FILE] Loading HTML template editLayerDefs
[RENDER] Rendering world bg...
[RENDER] Rendering world bg...
[USERACTION] Closed panel #31 ui.modal.panel.EditLayerDefs
[EVENT] LayerInstanceSelected 466
[RENDER] Rendered level UI
[RENDER] Rendering world bg...
[RENDER] Rendering world bg...
[RENDER] Rendering world bg...
[RENDER] Rendering world bg...
[EVENT] LayerInstanceSelected 3
[USERACTION] Opened panel #37 ui.modal.panel.EditAllAutoLayerRules
[FILE] Reading HTML template editAllAutoLayerRules from cache
[RENDER] Rendered level UI
[RENDER] Rendering world bg...
[RENDER] Rendering world bg...
[USERACTION] Closed panel #37 ui.modal.panel.EditAllAutoLayerRules
[EVENT] LayerInstanceSelected 466
[USERACTION] Opened panel #40 ui.modal.panel.EditAllAutoLayerRules
[FILE] Reading HTML template editAllAutoLayerRules from cache
[RENDER] Rendered level UI
[RENDER] Rendering world bg...
[RENDER] Rendering world bg...
[RENDER] Rendering world bg...
[FILE] Loading HTML template rulesWizard.html
[RENDER] Rendering world bg...
[FILE] Reading HTML template rulesWizard.html from cache
[GENERAL] Page started: page.CrashReport()
[FILE] Loading page template: crashReport from C:/Users/Snowdrama/AppData/Local/Programs/ldtk/resources/app.asar/assets/tpl/pages/crashReport.html
[ERROR] Cannot read properties of null (reading 'identifier') (TypeError)
[ERROR] TypeError: Cannot read properties of null (reading 'identifier')
at ui_modal_dialog_RulesWizard.updateIntGridValue (file:///C:/Users/Snowdrama/AppData/Local/Programs/ldtk/resources/app.asar/assets/js/renderer.js:298006:17)
at ui_modal_dialog_RulesWizard.updateUI (file:///C:/Users/Snowdrama/AppData/Local/Programs/ldtk/resources/app.asar/assets/js/renderer.js:297888:8)
at new ui_modal_dialog_RulesWizard (file:///C:/Users/Snowdrama/AppData/Local/Programs/ldtk/resources/app.asar/assets/js/renderer.js:297664:7)
at ui_modal_panel_EditAllAutoLayerRules.doUseWizard (file:///C:/Users/Snowdrama/AppData/Local/Programs/ldtk/resources/app.asar/assets/js/renderer.js:300720:3)
at HTMLButtonElement.<anonymous> (file:///C:/Users/Snowdrama/AppData/Local/Programs/ldtk/resources/app.asar/assets/js/renderer.js:301029:12)
at HTMLButtonElement.dispatch (C:\Users\Snowdrama\AppData\Local\Programs\ldtk\resources\app.asar\assets\js\jquery.min.js:2:43064)
at v.handle (C:\Users\Snowdrama\AppData\Local\Programs\ldtk\resources\app.asar\assets\js\jquery.min.js:2:41048)
[GENERAL]
#0 App
|--- #3 page.Editor
|--- #4 misc.FileWatcher
|--- #5 display.WorldRender
|--- #6 display.LevelRender
|--- #7 display.Camera
|--- #8 display.Rulers[--]
|--- #9 tool.SelectionTool[--]
|--- #10 tool.lt.DoNothing[--]
|--- #11 WorldTool
|--- #12 tool.PanView[--]
|--- #13 tool.lt.DoNothing [PAUSED][--]
|--- #15 tool.lt.IntGridTool [PAUSED][--]
|--- #33 tool.lt.IntGridTool[--]
|--- #40 ui.modal.panel.EditAllAutoLayerRules
|--- #44 ui.modal.dialog.RulesWizard
|--- #45 page.CrashReport
[FILE] Cleared all file watches