prevent reading property 'collides' of undefined

fixes e2e tests
This commit is contained in:
Lukas Hass 2022-02-14 22:07:15 +01:00
parent ae46a1faf1
commit ae8c18fa4b
No known key found for this signature in database
GPG Key ID: 7C8CEF72C4039178

View File

@ -336,7 +336,9 @@ export class GameMap {
if (!layer.visible) {
continue;
}
if (layer.getTileAt(x, y)?.properties[GameMapProperties.COLLIDES]) {
// TODO: use optional chaining when https://github.com/DevExpress/testcafe-hammerhead/issues/2714 is fixed
const properties = layer.getTileAt(x, y)?.properties;
if (properties && properties[GameMapProperties.COLLIDES]) {
return true;
}
}