Fix bug254#261
Open
FC383 wants to merge 3 commits into
Open
Conversation
修复 fix Pacalini#254 的遗留问题:getAll 检测到 JSON 损坏记录后仅调用 _safeDelete 删除 DB 行,磁盘上的漫画目录(含 cover.jpg 及图片文件) 成为孤儿文件永久残留。 新增 _tryCleanDisk 辅助方法,在 _safeDelete 前清理对应磁盘目录。 磁盘清理失败不影响 DB 删除,目录不存在时跳过。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix #254
fix: 修复已下载漫画1300+时因单条损坏记录导致页面白屏崩溃
PR Description:
问题
已下载漫画数量达到 1300+ 后打开已下载页面白屏崩溃。根本原因是下载数据库中某条记录的 JSON 数据损坏,而
getAll方法零容错。根因
getAll使用result.map(...).toList()并对_getComicFromJson返回值使用空断言!Map<String, dynamic>)时,_getComicFromJson返回 null!触发Null check operator used on a null value异常,整个页面崩溃——其余正常记录全部不可访问修改
lib/network/download.dart_getComicFromJson中添加decoded is! Map<String, dynamic>类型守卫getAll从map(...).toList()改为 for 循环 + try-catch_safeDelete辅助方法,安全删除损坏记录且自身不崩##遗留bug
只删除了db中的数据,残留的孤儿磁盘文件和文件夹没有删除