bc46990 Backport two patches from upstream to really fix crashes (#2177287)

Authored and Committed by adamwill a year ago
    Backport two patches from upstream to really fix crashes (#2177287)
    
    I'm pretty sure we really got it this time!
    
        
file modified
+11 -1