The passed DocumentObject pointer can be null which is nowhere checked. This fixes issue 19545 Fixes: 256ad7a01a ("PartDesign: Loft Intelligence - Select the whole sketch if the selected shape is ...")
256ad7a01a