Add check for null stream from ContentResolver when encoding