mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Attempt to fix NPE in ComboBox from EA reports
This commit is contained in:
+6
-3
@@ -397,7 +397,7 @@ public class DarculaComboBoxUI extends BasicComboBoxUI implements Border, ErrorB
|
||||
Insets i = getInsets();
|
||||
Dimension abSize = arrowButton.getPreferredSize();
|
||||
|
||||
if (isCompact(comboBox)) {
|
||||
if (isCompact(comboBox) && size != null) {
|
||||
JBInsets.removeFrom(size, padding); // don't count paddings in compact mode
|
||||
}
|
||||
|
||||
@@ -405,8 +405,11 @@ public class DarculaComboBoxUI extends BasicComboBoxUI implements Border, ErrorB
|
||||
int editorWidth = editorSize != null ? editorSize.width + i.left + padding.left + padding.right : 0;
|
||||
editorWidth = Math.max(editorWidth, MINIMUM_WIDTH.get() + i.left);
|
||||
|
||||
int width = Math.max(editorWidth + abSize.width, size.width + padding.left);
|
||||
int height = Math.max(Math.max(editorHeight, Math.max(abSize.height, size.height)),
|
||||
int width = size != null ? size.width : 0;
|
||||
int height = size != null ? size.height : 0;
|
||||
|
||||
width = Math.max(editorWidth + abSize.width, width + padding.left);
|
||||
height = Math.max(Math.max(editorHeight, Math.max(abSize.height, height)),
|
||||
(isCompact(comboBox) ? COMPACT_HEIGHT.get() : MINIMUM_HEIGHT.get()) + i.top + i.bottom);
|
||||
|
||||
return new Dimension(width, height);
|
||||
|
||||
+7
-2
@@ -84,8 +84,13 @@ public class MacIntelliJComboBoxUI extends DarculaComboBoxUI {
|
||||
int editorWidth = editorSize != null ? editorSize.width + i.left + padding.left + padding.right : 0;
|
||||
editorWidth = Math.max(editorWidth, MINIMUM_WIDTH.get() + i.left);
|
||||
|
||||
return new Dimension(Math.max(size.width + padding.left, editorWidth + iconWidth),
|
||||
Math.max(Math.max(iconHeight, size.height), editorHeight));
|
||||
int width = size != null ? size.width : 0;
|
||||
int height = size != null ? size.height : 0;
|
||||
|
||||
width = Math.max(width + padding.left, editorWidth + iconWidth);
|
||||
height = Math.max(Math.max(iconHeight, height), editorHeight);
|
||||
|
||||
return new Dimension(width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+7
-2
@@ -447,8 +447,13 @@ public class WinIntelliJComboBoxUI extends DarculaComboBoxUI {
|
||||
int editorWidth = editorSize != null ? editorSize.width + i.left + padding.left + padding.right : 0;
|
||||
editorWidth = Math.max(editorWidth, MINIMUM_WIDTH.get() + i.left);
|
||||
|
||||
return new Dimension(Math.max(editorWidth + ARROW_BUTTON_SIZE.width, size.width + padding.left),
|
||||
Math.max(ARROW_BUTTON_SIZE.height, Math.max(editorHeight, size.height)));
|
||||
int width = size != null ? size.width : 0;
|
||||
int height = size != null ? size.height : 0;
|
||||
|
||||
width = Math.max(editorWidth + ARROW_BUTTON_SIZE.width, width + padding.left);
|
||||
height = Math.max(ARROW_BUTTON_SIZE.height, Math.max(editorHeight, height));
|
||||
|
||||
return new Dimension(width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user