You've already forked Nitro_Render_V3
mirror of
https://github.com/duckietm/Nitro_Render_V3.git
synced 2026-06-19 15:06:20 +00:00
fix(room): guard RoomPreviewer.updatePreviewModel against null _planeParser
After dispose() nulls out the internal _planeParser / _backgroundSprite refs, any further updatePreviewModel call crashed with 'this._planeParser is null'. React 19 StrictMode in dev double-mounts effects (setup, cleanup, setup again), which can briefly leave a consumer holding a stale reference to a disposed previewer between the two setup runs. Bail silently in that window instead of crashing the editor.
This commit is contained in:
@@ -136,6 +136,12 @@ export class RoomPreviewer
|
|||||||
|
|
||||||
public updatePreviewModel(model: string, wallHeight: number, scale: boolean = true): void
|
public updatePreviewModel(model: string, wallHeight: number, scale: boolean = true): void
|
||||||
{
|
{
|
||||||
|
// Defensive: dispose() nulls _planeParser, and React 19
|
||||||
|
// StrictMode dev double-mount can leave a stale reference
|
||||||
|
// briefly pointing at a disposed instance. Bail rather
|
||||||
|
// than crashing with "cannot read property reset of null".
|
||||||
|
if(!this._planeParser) return;
|
||||||
|
|
||||||
const parser = new FloorHeightMapMessageParser();
|
const parser = new FloorHeightMapMessageParser();
|
||||||
|
|
||||||
parser.flush();
|
parser.flush();
|
||||||
|
|||||||
Reference in New Issue
Block a user