This is an automated email from the ASF dual-hosted git repository.
vladimirsitnikov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git
The following commit(s) were added to refs/heads/master by this push:
new d556c65 Bug 64285 - Avoid NPE when Clearing after switching to a
different LAF
d556c65 is described below
commit d556c65ceb09cf4846670d710d0060d075bc543f
Author: Vladimir Sitnikov <[email protected]>
AuthorDate: Sun Mar 29 22:03:09 2020 +0300
Bug 64285 - Avoid NPE when Clearing after switching to a different LAF
tabbedPane.getTabComponentAt might return null in case tab component is not
customized.
updateUI code should consider both getTabComponentAt and getComponentAt.
See
https://stackoverflow.com/questions/988734/jtabbedpane-gettabcomponentatint-returning-null
---
.../src/main/java/org/apache/jorphan/gui/DynamicStyle.java | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/jorphan/src/main/java/org/apache/jorphan/gui/DynamicStyle.java
b/src/jorphan/src/main/java/org/apache/jorphan/gui/DynamicStyle.java
index 15dc73c..7fb0197 100644
--- a/src/jorphan/src/main/java/org/apache/jorphan/gui/DynamicStyle.java
+++ b/src/jorphan/src/main/java/org/apache/jorphan/gui/DynamicStyle.java
@@ -184,6 +184,11 @@ public class DynamicStyle {
}
private static void collectComponents(Component root, List<Component>
components) {
+ if (root == null) {
+ // E.g. getTabComponentAt might return null
+ //
https://stackoverflow.com/questions/988734/jtabbedpane-gettabcomponentatint-returning-null
+ return;
+ }
components.add(root);
if (root instanceof JComponent) {
JComponent jc = (JComponent) root;
@@ -216,6 +221,9 @@ public class DynamicStyle {
JTabbedPane tabbedPane = (JTabbedPane) root;
int size = tabbedPane.getTabCount();
for (int i = 0; i < size; i++) {
+ // This is the contents of the tab
+ collectComponents(tabbedPane.getComponentAt(i), components);
+ // This is the tab itself (might be null)
collectComponents(tabbedPane.getTabComponentAt(i), components);
}
}