fix #661: fixes a NPE when media refresh fails and activity detached

fix #661: fixes a NPE when media refresh fails and activity detached