OSDN Git Service

fix: delete potential null access
authorhizumiaoba <56146205+hizumiaoba@users.noreply.github.com>
Sun, 14 Nov 2021 02:37:50 +0000 (11:37 +0900)
committerhizumiaoba <56146205+hizumiaoba@users.noreply.github.com>
Sun, 14 Nov 2021 02:37:50 +0000 (11:37 +0900)
src/com/ranfa/lib/Scraping.java

index 219e912..f764f4b 100644 (file)
@@ -218,7 +218,11 @@ public class Scraping {
                        e.printStackTrace();
                }
                ArrayList<Song> res = new ArrayList<Song>();
-               res.addAll(property.getList());
+               if(property != null) {
+                       res.addAll(property.getList());
+               } else {
+                       throw new NullPointerException("json is null.");
+               }
                logger.info("JSON reading compeleted in " + (System.currentTimeMillis() - time) + "ms");
                return res;
        }