OSDN Git Service

fix: fix #52 #53
authorhizumiaoba <56146205+hizumiaoba@users.noreply.github.com>
Wed, 13 Apr 2022 12:50:45 +0000 (21:50 +0900)
committerhizumiaoba <56146205+hizumiaoba@users.noreply.github.com>
Wed, 13 Apr 2022 12:50:45 +0000 (21:50 +0900)
src/com/ranfa/lib/handler/CrashReportList.java
src/com/ranfa/main/DelesteRandomSelector.java

index 8804250..d30f6a8 100644 (file)
@@ -2,6 +2,7 @@ package com.ranfa.lib.handler;
 
 import java.io.FileWriter;
 import java.io.IOException;
+import java.nio.file.Files;
 import java.nio.file.Paths;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
@@ -45,6 +46,8 @@ public class CrashReportList <E> extends ArrayList<E> {
        
        public void outCrashReport() {
                try {
+                       if(Files.notExists(Paths.get("Crash-Report")))
+                               Files.createDirectory(Paths.get("Crash-Report"));
                        FileWriter writer = new FileWriter(Paths.get("Crash-Report/" + FORMAT.format(new Date()) + ".txt").toFile());
                        writer.write(generateCrashReport());
                        writer.close();
index 4be80c0..8ac80c6 100644 (file)
@@ -632,6 +632,10 @@ public class DelesteRandomSelector extends JFrame {
                        String currentTabName = tabbedPane.getTitleAt(tabbedPane.getSelectedIndex());
                        if(currentTabName.equals("SongInfo") && labelCurrentSongOrderTool.getText().equals("null")) {
                                logger.info("Detected switching tool tab");
+                               if(listToolMapDataFuture == null) {
+                                       logger.warn("Async task has not initialized yet. Aborting...");
+                                       return;
+                               }
                                if(toolIntegrateList == null) {
                                        return;
                                }