Repository navigation
Return false from TryGetCadObject when the object is not of the requested type - #1273
Merged
Merged
Conversation
DomCR
reviewed
Oct 8, 2026
|
|
||
| namespace ACadSharp.Tests.Internal; | ||
|
|
||
| public class CadDocumentBuilderTests |
Owner
There was a problem hiding this comment.
I don't think this one is needed, the functionality is tested in the local validation and the other reading tests.
DomCR
approved these changes
Oct 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CadDocument.TryGetCadObject<T>returned true with a null object when the handle belonged to an object of another type.BuildDataStoragerelies on it, so since #1270 a DWG with an ACDS record that belongs to an entity that is not aModelerGeometrythrows aNullReferenceExceptionand the whole read fails. I hit it on a 2013 DWG with REVOLVEDSURFACE entities, read withKeepUnknownEntities = true.The method now checks the type, as the version in
CadDocumentBuilderalready does. Nothing in the repo relied on the old behavior.I added two tests: the type mismatch on
CadDocument, andBuildDataStoragewith a record that points to an unknown surface entity, which threw before the fix.