This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-bcel.git

commit 970e05aab3f6e57e713880efdbcc13d1cee60f00
Author: Gary David Gregory (Code signing key) <ggreg...@apache.org>
AuthorDate: Fri Oct 7 10:32:14 2022 -0400

    Clearer test for nullable local variable.
---
 src/main/java/org/apache/bcel/generic/MethodGen.java | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/apache/bcel/generic/MethodGen.java 
b/src/main/java/org/apache/bcel/generic/MethodGen.java
index c4ef9180..2b7693cc 100644
--- a/src/main/java/org/apache/bcel/generic/MethodGen.java
+++ b/src/main/java/org/apache/bcel/generic/MethodGen.java
@@ -801,10 +801,7 @@ public class MethodGen extends FieldGenOrMethodGen {
         /*
          * Also updates positions of instructions, i.e., their indices
          */
-        byte[] byteCode = null;
-        if (il != null) {
-            byteCode = il.getByteCode();
-        }
+        byte[] byteCode = il != null ? il.getByteCode() : null;
         LineNumberTable lnt = null;
         LocalVariableTable lvt = null;
         /*
@@ -836,7 +833,7 @@ public class MethodGen extends FieldGenOrMethodGen {
         final CodeException[] cExc = getCodeExceptions();
         final int exc_len = cExc.length * 8; // Every entry takes 8 bytes
         Code code = null;
-        if (il != null && !isAbstract() && !isNative()) {
+        if (byteCode != null && !isAbstract() && !isNative()) {
             // Remove any stale code attribute
             final Attribute[] attributes = getAttributes();
             for (final Attribute a : attributes) {

Reply via email to