Fixes two crashes reported by @efriedma and @ahatanak, as per
@ahatanak's analysis.
Link: https://reviews.llvm.org/D151587#4397446
Link: https://reviews.llvm.org/D151587#4399684