Do not deref (potentially dangling) weak_ptr

Change-Id: Ic9694aa8bd85fe0548b8f5fc5f52b4bbd6dce1cf