修复鸿蒙系统下的崩溃问题

This commit is contained in:
lyswhut 2022-12-10 15:34:39 +08:00
parent bd4742d567
commit baa3d22a2c
4 changed files with 13 additions and 11 deletions

View File

@ -124,7 +124,8 @@ public class LyricPlayer {
Matcher timeMatchResult = timePattern.matcher(timeField); Matcher timeMatchResult = timePattern.matcher(timeField);
while (timeMatchResult.find()) { while (timeMatchResult.find()) {
String timeStr = timeMatchResult.group(); String timeStr = timeMatchResult.group();
timeStr = timeStr.replaceAll("(?:\\.0+|(\\.\\d+?)0+)$", "$1"); if (!timeStr.contains(".")) timeStr += ".0";
timeStr = timeStr.replaceAll("(?:\\.0+|0+)$", "");
HashMap targetLine = (HashMap) linesMap.get(timeStr); HashMap targetLine = (HashMap) linesMap.get(timeStr);
if (targetLine != null) ((ArrayList<String>) targetLine.get("extendedLyrics")).add(text); if (targetLine != null) ((ArrayList<String>) targetLine.get("extendedLyrics")).add(text);
} }
@ -150,7 +151,8 @@ public class LyricPlayer {
Matcher timeMatchResult = timePattern.matcher(timeField); Matcher timeMatchResult = timePattern.matcher(timeField);
while (timeMatchResult.find()) { while (timeMatchResult.find()) {
String timeStr = timeMatchResult.group(); String timeStr = timeMatchResult.group();
timeStr = timeStr.replaceAll("(?:\\.0+|(\\.\\d+?)0+)$", "$1"); if (!timeStr.contains(".")) timeStr += ".0";
timeStr = timeStr.replaceAll("(?:\\.0+|0+)$", "");
if (linesMap.containsKey(timeStr)) { if (linesMap.containsKey(timeStr)) {
((ArrayList<String>) ((HashMap) linesMap.get(timeStr)).get("extendedLyrics")).add(text); ((ArrayList<String>) ((HashMap) linesMap.get(timeStr)).get("extendedLyrics")).add(text);
continue; continue;

14
package-lock.json generated
View File

@ -19,7 +19,7 @@
"events": "^3.3.0", "events": "^3.3.0",
"i18next": "^22.1.5", "i18next": "^22.1.5",
"js-htmlencode": "^0.3.0", "js-htmlencode": "^0.3.0",
"lrc-file-parser": "^2.2.6", "lrc-file-parser": "^2.2.7",
"pako": "^2.1.0", "pako": "^2.1.0",
"process": "^0.11.10", "process": "^0.11.10",
"prop-types": "^15.8.1", "prop-types": "^15.8.1",
@ -9691,9 +9691,9 @@
} }
}, },
"node_modules/lrc-file-parser": { "node_modules/lrc-file-parser": {
"version": "2.2.6", "version": "2.2.7",
"resolved": "https://registry.npmjs.org/lrc-file-parser/-/lrc-file-parser-2.2.6.tgz", "resolved": "https://registry.npmjs.org/lrc-file-parser/-/lrc-file-parser-2.2.7.tgz",
"integrity": "sha512-UftPzQMKaz8U7gZZRvULnL2lenr7giwkVVToY1LD1R2R+wk+ERQP6F/HDnTvXoM3ZWI/jXRx7py33NIiM/5CSQ==" "integrity": "sha512-gH/5FYUdrQ7YTzNpkBM8fLFsM4OUh0pgYtvgvasDI5eSKW9kQbE/xRYeWKw/++9hBrTI9iGzujuvaFr4qYJaBQ=="
}, },
"node_modules/lru-cache": { "node_modules/lru-cache": {
"version": "6.0.0", "version": "6.0.0",
@ -21624,9 +21624,9 @@
} }
}, },
"lrc-file-parser": { "lrc-file-parser": {
"version": "2.2.6", "version": "2.2.7",
"resolved": "https://registry.npmjs.org/lrc-file-parser/-/lrc-file-parser-2.2.6.tgz", "resolved": "https://registry.npmjs.org/lrc-file-parser/-/lrc-file-parser-2.2.7.tgz",
"integrity": "sha512-UftPzQMKaz8U7gZZRvULnL2lenr7giwkVVToY1LD1R2R+wk+ERQP6F/HDnTvXoM3ZWI/jXRx7py33NIiM/5CSQ==" "integrity": "sha512-gH/5FYUdrQ7YTzNpkBM8fLFsM4OUh0pgYtvgvasDI5eSKW9kQbE/xRYeWKw/++9hBrTI9iGzujuvaFr4qYJaBQ=="
}, },
"lru-cache": { "lru-cache": {
"version": "6.0.0", "version": "6.0.0",

View File

@ -51,7 +51,7 @@
"events": "^3.3.0", "events": "^3.3.0",
"i18next": "^22.1.5", "i18next": "^22.1.5",
"js-htmlencode": "^0.3.0", "js-htmlencode": "^0.3.0",
"lrc-file-parser": "^2.2.6", "lrc-file-parser": "^2.2.7",
"pako": "^2.1.0", "pako": "^2.1.0",
"process": "^0.11.10", "process": "^0.11.10",
"prop-types": "^15.8.1", "prop-types": "^15.8.1",

View File

@ -1,3 +1,3 @@
### 修复 ### 修复
- 修复潜在的歌词解析导致应用崩溃问题 - 修复鸿蒙系统下的崩溃问题