Improve error handling in dynamic casting#903
Open
axel-grc wants to merge 2 commits intoRTKConsortium:mainfrom
Open
Improve error handling in dynamic casting#903axel-grc wants to merge 2 commits intoRTKConsortium:mainfrom
axel-grc wants to merge 2 commits intoRTKConsortium:mainfrom
Conversation
SimonRit
reviewed
Feb 24, 2026
| dynamic_cast<rtk::FDKWarpBackProjectionImageFilter<OutputImageType, OutputImageType, DeformationType> *>( | ||
| bp.GetPointer()) | ||
| ->SetDeformation(def); | ||
| auto * fdkWarp = |
Collaborator
There was a problem hiding this comment.
I find the proposed changes too systematic. Here, it is obvious that it won't fail, it's been instantiated with this type 2 lines above. Can you go over the changes and only check the ones for which it might not work?
…d filters - Add null checks for dynamic_cast in metadata readers (Digisens, ImagX, VarianObi, VarianProBeam, XRad) to catch malformed file data - Add null checks for external object casts (GDCMImageIO, DOMTextNode, QuadricShape) where type isn't guaranteed at runtime - Improves error reporting with descriptive messages instead of silent null pointer dereferences (closes RTKConsortium#881)
- Move subclass-specific configuration into switch cases where concrete type is known - Eliminates unsafe dynamic_cast in rtkbackprojections, rtkforwardprojections, and factory methods
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.
Close #881