Check that the correct component is visible.
Merge pull request #1893 from jburel/viewed-by-crash

Check that the correct component is visible.