Skip to content

Commit

Permalink
Merge branch 'fix/crash-if-no-custom-layers' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
IR0NSIGHT committed Nov 30, 2023
2 parents dc40f51 + 0a1ebf7 commit 64ad38f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/worldpainterApi/worldpainterApi.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ParsingError } from '../FileOperation/Parser';
import { Layer } from '../Layer/Layer';
import { log } from "../log";

export function getTerrainById(terrainId: number): Terrain {
// @ts-ignore worldpainter java object
Expand Down Expand Up @@ -52,6 +53,8 @@ export function getLayerById(layerId: string): Layer | ParsingError {
default: {
//search for custom layers
const customLayers: Layer[] = dimension.getCustomLayers();
if (!Array.isArray(customLayers))
return { mssg: 'no custom layers found in project: ' + layerId };
let matched: Layer | undefined = undefined;
customLayers
.filter((f) => f != null)
Expand Down

0 comments on commit 64ad38f

Please sign in to comment.