You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by vl...@apache.org on 2020/03/26 22:29:19 UTC

[jmeter] branch master updated: Avoid NPE in TCP Sampler when Darklaf look and feel is used

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 0123013  Avoid NPE in TCP Sampler when Darklaf look and feel is used
0123013 is described below

commit 01230139d3606ddc79d7d7c68996ce38a282648d
Author: Vladimir Sitnikov <si...@gmail.com>
AuthorDate: Fri Mar 27 01:19:23 2020 +0300

    Avoid NPE in TCP Sampler when Darklaf look and feel is used
    
    The NPE is caused because LaF does not have CheckBox.icon property
---
 .../main/java/org/apache/jmeter/gui/util/TristateCheckBox.java   | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/core/src/main/java/org/apache/jmeter/gui/util/TristateCheckBox.java b/src/core/src/main/java/org/apache/jmeter/gui/util/TristateCheckBox.java
index f3bcad5..df27755 100644
--- a/src/core/src/main/java/org/apache/jmeter/gui/util/TristateCheckBox.java
+++ b/src/core/src/main/java/org/apache/jmeter/gui/util/TristateCheckBox.java
@@ -303,9 +303,12 @@ public final class TristateCheckBox extends JCheckBox {
         public TristateCheckBoxIcon() {
             // Assume that the UI has not changed since the checkbox was created
             UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-            final Icon icon = (Icon) defaults.get("CheckBox.icon");
-            iconHeight = icon.getIconHeight();
-            iconWidth = icon.getIconWidth();
+            Icon icon = defaults.getIcon("CheckBox.icon");
+            if (icon == null) {
+                icon = defaults.getIcon("CheckBox.selected.icon");
+            }
+            iconHeight = icon == null ? 19 : icon.getIconHeight();
+            iconWidth = icon == null ? 19 : icon.getIconWidth();
         }
 
         @Override