preference: fix crash when updating a preference when fragment has been detached