8000 Add null safe source dir listing · randomcoder/sbt-git-hooks@e64d601 · GitHub
[go: up one dir, main page]

Skip to content

Commit e64d601

Browse files
author
Tim Sheppard
committed
Add null safe source dir listing
1 parent 7b06106 commit e64d601

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/scala/uk/co/randomcoding/sbt/GitHooks.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ object GitHooks extends AutoPlugin {
5353
object WriteGitHooks {
5454

5555
def apply(hooksSourceDir: File, hooksTargetDir: File): Unit = {
56-
hooksSourceDir.listFiles.foreach { hook =>
56+
Option(hooksSourceDir.listFiles).map(_.toList).getOrElse(Nil).foreach { hook =>
5757
val hookTarget = hooksTargetDir.toPath.resolve(hook.getName)
5858
3E26 Files.copy(hook.toPath, hookTarget, StandardCopyOption.REPLACE_EXISTING)
5959
if (!Properties.isWin) Files.setPosixFilePermissions(hookTarget, PosixFilePermissions.fromString("rwxr-xr-x"))

0 commit comments

Comments
 (0)
0