Skip to content

Commit

Permalink
Fix a crash that sometimes happens when deleting links of an object (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
D8H authored Mar 1, 2024
1 parent e1c22f6 commit ba8d7f4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Extensions/LinkedObjects/linkedobjects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ GDevelop - LinkedObjects Extension
Copyright (c) 2013-2016 Florian Rival ([email protected])
*/
namespace gdjs {
const logger = new gdjs.Logger('LinkedObjects');
/**
* Manages the links between objects.
*/
Expand Down Expand Up @@ -114,7 +115,14 @@ namespace gdjs {
if (this._links.has(linkedObject.id)) {
const otherObjList = this._links
.get(linkedObject.id)!
.linkedObjectMap.get(removedObject.getName())!;
.linkedObjectMap.get(removedObject.getName());

if (!otherObjList) {
logger.error(
`Can't find link from ${linkedObject.id} (${linkedObject.name}) to ${removedObject.id} (${removedObject.name})`
);
return;
}

const index = otherObjList.indexOf(removedObject);
if (index !== -1) {
Expand Down

0 comments on commit ba8d7f4

Please sign in to comment.