Fix NullPointerExceptions on OS X with Java 1.8

Basically it looks like with Java 1.8 on OS X JTabbedPane.getBoundsAt(int) will often return null, probably for elements displayed but not currently visible (like tabs in a tab bar not shown because the bar is not wide enough). None of the usages of this method took into account the null case.