Skip to content

Commit

Permalink
Merge pull request #352 from DomCR/image-base-fix
Browse files Browse the repository at this point in the history
Image base fix
  • Loading branch information
DomCR authored Jun 2, 2024
2 parents 346445a + 399e94d commit 276dc96
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions ACadSharp/Entities/CadImageBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,20 @@ internal override void AssignDocument(CadDocument doc)

this._definition = this.updateCollection(this.Definition, doc.ImageDefinitions);

this.Document.ImageDefinitions.OnRemove += this.imageDefinitionsOnRemove;
// The definitions entry is optional, some documents do not have it.
if (this.Document.ImageDefinitions != null)
{
this.Document.ImageDefinitions.OnRemove += this.imageDefinitionsOnRemove;
}
}

internal override void UnassignDocument()
{
this.Document.ImageDefinitions.OnRemove -= this.imageDefinitionsOnRemove;
// The definitions entry is optional, some documents do not have it.
if (this.Document.ImageDefinitions != null)
{
this.Document.ImageDefinitions.OnRemove -= this.imageDefinitionsOnRemove;
}

base.UnassignDocument();

Expand Down
2 changes: 1 addition & 1 deletion CSUtilities

0 comments on commit 276dc96

Please sign in to comment.