Fix for NLPCRAFT-262.
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCli.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCli.scala
index 0d411f0..4990849 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCli.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCli.scala
@@ -470,13 +470,16 @@
     private def cleanUpTempFiles(): Unit = {
         val tstamp = currentTime - 1000 * 60 * 60 * 24 * 2 // 2 days ago.
 
-        for (file <- new File(SystemUtils.getUserHome, ".nlpcraft").listFiles())
-            if (file.lastModified() < tstamp) {
-                val name = file.getName
-
-                if (name.startsWith("server_log") || name.startsWith("server_log") || name.startsWith(".pid_"))
-                    file.delete()
-            }
+        val files = new File(SystemUtils.getUserHome, ".nlpcraft").listFiles()
+        
+        if (files != null)
+            for (file <- files)
+                if (file.lastModified() < tstamp) {
+                    val name = file.getName
+    
+                    if (name.startsWith("server_log") || name.startsWith("server_log") || name.startsWith(".pid_"))
+                        file.delete()
+                }
     }
 
     /**