LunaChat v3.0.1 : fixed issue #171.

このコミットが含まれているのは:
ucchy committed 2020-06-18 00:17:53 +09:00
1 親 4a5bc4ccfa
コミット f4d736cc50
2ファイル変更
+14 -3

検索条件に一致するファイルはありません

+13 -2
ファイルの表示
@@ -66,12 +66,19 @@ public class YamlConfig {
}
public static YamlConfig load(File file) {
// 対象ファイルが存在しない場合やからっぽの場合は、からっぽのYamlConfigを返す
if ( !file.exists() || !file.isFile() || file.length() == 0 ) return new YamlConfig();
// 読み込む
try ( InputStreamReader reader = new InputStreamReader(new FileInputStream(file), "UTF-8") ) {
return load(reader);
} catch (IOException e) {
e.printStackTrace();
}
return null;
// 読み込みに失敗した場合は、からっぽのYamlConfigを返す
return new YamlConfig();
}
public void save(File file) throws IOException {
@@ -148,6 +155,10 @@ public class YamlConfig {
}
public void addDefaults(YamlConfig defaults) {
this.defaults = defaults.map;
if (defaults == null) {
this.defaults = new HashMap<String, Object>();
} else {
this.defaults = defaults.map;
}
}
}