Fix possible NPE'S

if problems with corrupted media data are present

Change-Id: Ia32f9eaceea2a3c27a4d73212b51f4c5e3242649