mirror of
https://github.com/RatzzFatzz/MKVAudioSubtitleChanger.git
synced 2026-02-11 02:05:56 +01:00
Update dependencies & fix null pointer exception when file has missing properties or none at all
This commit is contained in:
10
pom.xml
10
pom.xml
@@ -106,17 +106,17 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-api</artifactId>
|
||||
<version>2.15.0</version>
|
||||
<version>2.17.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<version>2.15.0</version>
|
||||
<version>2.17.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-slf4j-impl</artifactId>
|
||||
<version>2.12.0</version>
|
||||
<version>2.17.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
@@ -137,12 +137,12 @@
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-yaml</artifactId>
|
||||
<version>2.9.9</version>
|
||||
<version>2.13.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.10.0.pr1</version>
|
||||
<version>2.13.1</version>
|
||||
</dependency>
|
||||
<!-- endregion -->
|
||||
<!-- region unit-tests -->
|
||||
|
||||
@@ -21,6 +21,9 @@ public class AttributeUpdaterKernel {
|
||||
if(allValidPaths != null && configPattern != null){
|
||||
for(File file : allValidPaths){
|
||||
List<FileAttribute> attributes = collector.loadAttributes(file);
|
||||
if (attributes.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
boolean fileHasChanged = false;
|
||||
for(AttributeConfig config : configPattern){
|
||||
/*
|
||||
|
||||
@@ -74,6 +74,10 @@ public class MkvFileCollector implements FileCollector {
|
||||
InputStream inputStream = Runtime.getRuntime().exec(array).getInputStream();
|
||||
jsonMap = mapper.readValue(inputStream, Map.class);
|
||||
List<Map<String, Object>> tracks = (List<Map<String, Object>>) jsonMap.get("tracks");
|
||||
if (tracks == null) {
|
||||
log.warn("Couldn't retrieve information of {}", file.getAbsoluteFile().toString());
|
||||
return new ArrayList<>();
|
||||
}
|
||||
for (Map<String, Object> attribute : tracks) {
|
||||
if (!"video".equals(attribute.get("type"))) {
|
||||
Map<String, Object> properties = (Map<String, Object>) attribute.get("properties");
|
||||
@@ -81,8 +85,8 @@ public class MkvFileCollector implements FileCollector {
|
||||
(int) properties.get("number"),
|
||||
(String) properties.get("language"),
|
||||
(String) properties.get("track_name"),
|
||||
(Boolean) properties.get("default_track"),
|
||||
(Boolean) properties.get("forced_track"),
|
||||
(Boolean) properties.getOrDefault("default_track", false),
|
||||
(Boolean) properties.getOrDefault("forced_track", false),
|
||||
(String) attribute.get("type")));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user