Check that activity != null before showing toast message in edit media c...

Fix #806