Adding null check in bitmap creation.