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-compress.git

commit 2a837c71777c784f8d890c952e6b854ca67faba7
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Sat Oct 28 07:24:03 2023 -0400

    Null-guard Lister.main(String[]) for programmatic invocation
---
 src/changes/changes.xml                                         | 1 +
 src/main/java/org/apache/commons/compress/archivers/Lister.java | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 8ac498c1..0e6d6fc3 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -69,6 +69,7 @@ The <action> type attribute can be add,update,fix,remove.
       <action type="fix" dev="ggregory" due-to="Gary Gregory">Precompile 
regular expression in 
TarArchiveEntry.parseInstantFromDecimalSeconds(String).</action>
       <action type="fix" dev="ggregory" due-to="Gary Gregory">Precompile 
regular expression in ChangeSet.addDeletion(Change).</action>
       <action type="fix" dev="ggregory" due-to="Gary Gregory" 
issue="COMPRESS-649">Improve performance in 
BlockLZ4CompressorOutputStream.</action>
+      <action type="fix" dev="ggregory" due-to="Gary Gregory">Null-guard 
Lister.main(String[]) for programmatic invocation.</action>
       <!-- UPDATE -->
       <action type="update" dev="ggregory" due-to="Dependabot">Bump 
org.slf4j:slf4j-api from 2.0.8 to 2.0.9 #413.</action>
       <action type="update" dev="ggregory" due-to="Gary Gregory">Bump 
commons-io:commons-io from 2.13.0 to 2.15.0.</action>
diff --git a/src/main/java/org/apache/commons/compress/archivers/Lister.java 
b/src/main/java/org/apache/commons/compress/archivers/Lister.java
index 3135b2b3..74dc25fa 100644
--- a/src/main/java/org/apache/commons/compress/archivers/Lister.java
+++ b/src/main/java/org/apache/commons/compress/archivers/Lister.java
@@ -108,7 +108,7 @@ public final class Lister {
      * @throws IOException an I/O exception.
      */
     public static void main(final String[] args) throws ArchiveException, 
IOException {
-        if (args.length == 0) {
+        if (args != null && args.length == 0) {
             usage();
             return;
         }

Reply via email to