Fix issue when switching branch when BLOB is shown

This fix one issue of #3666.

When browsing a project, and showing a file, if you try to switch to another branch this result in an error.

This commit should fix it.