IDEA-76618 NPE at com.intellij.xml.breadcrumbs.BreadcrumbsComponent.getPreferredSize

This commit is contained in:
Evgeny Zakrevsky
2011-11-10 20:30:31 +03:00
parent faedaf0b1d
commit 43ea5daaf6
2 changed files with 3 additions and 3 deletions
@@ -537,13 +537,13 @@ public class Splitter extends JPanel {
float proportion;
if (getOrientation()) {
if (getHeight() > 0) {
proportion = Math.min(1.0f, Math.max(getMinProportion(myFirstComponent), (float)myPoint.y / (float)Splitter.this.getHeight()));
proportion = Math.min(1.0f, Math.max(.0f, Math.min(Math.max(getMinProportion(myFirstComponent), (float)myPoint.y / (float)Splitter.this.getHeight()), 1 - getMinProportion(mySecondComponent))));
setProportion(proportion);
}
}
else {
if (getWidth() > 0) {
proportion = Math.min(1.0f, Math.max(getMinProportion(myFirstComponent), (float)myPoint.x / (float)Splitter.this.getWidth()));
proportion = Math.min(1.0f, Math.max(.0f, Math.min(Math.max(getMinProportion(myFirstComponent), (float)myPoint.x / (float)Splitter.this.getWidth()), 1 - getMinProportion(mySecondComponent))));
setProportion(proportion);
}
}
@@ -324,7 +324,7 @@ public class BreadcrumbsComponent<T extends BreadcrumbsItem> extends JComponent
public Dimension getPreferredSize() {
final Graphics2D g2 = (Graphics2D)getGraphics();
return new Dimension(Integer.MAX_VALUE, DEFAULT_PAINTER.getSize("DUMMY", g2.getFontMetrics(), Integer.MAX_VALUE).height + 1);
return new Dimension(Integer.MAX_VALUE, g2 != null ? DEFAULT_PAINTER.getSize("DUMMY", g2.getFontMetrics(), Integer.MAX_VALUE).height + 1 : 1);
}
public Dimension getMaximumSize() {