Fix null pointer errors.

PR#3394

(Imported from upstream's cea5a1d5f255a6a186cd7944c4a312612da965f3)
1 file changed