added extra null check for getExtension() result

Can't believe you messed this up and let me do all of the hard debugging... :)