filemanager: Add assertion checks to prevent dereferencing ptrs

* clang static analysis shows gaps where these calls could
  rereferencce pointers. Perform an assertion check.