fix #1215 prevent a crash if fragment hasn't attached activity

fix #1215