Skip to content
Permalink
Browse files

Fix NPE if directory can't be accessed.

  • Loading branch information...
Ferada committed Jun 2, 2017
1 parent 9c76a19 commit bdce7703a044b9ce5b02f3af87af309395e2f30e
Showing with 13 additions and 0 deletions.
  1. +5 −0 src/org/armedbear/lisp/Pathname.java
  2. +8 −0 test/lisp/abcl/pathname-tests.lisp
@@ -1667,6 +1667,11 @@ public LispObject execute(LispObject arg, LispObject resolveSymlinks) {
if (f.isDirectory()) {
try {
File[] files = f.listFiles();
if (files == null) {
return error(new FileError("Unable to list directory "
+ pathname.princToString() + ".",
pathname));
}
for (int i = files.length; i-- > 0;) {
File file = files[i];
Pathname p;
@@ -1732,3 +1732,11 @@
(deftest pathname.make-pathname.4
(directory-namestring (make-pathname :directory :unspecific))
"")

;; note that some inaccessible directory needs to be present for this to raise
;; an error
(deftest pathname.directory.1
(signals-error
(directory "/*/")
'file-error)
t)

0 comments on commit bdce770

Please sign in to comment.
You can’t perform that action at this time.