Crash on Nintendo Switch
还没有人认领这个 Issue。
评估
调研方向
首先在 SwiftMTP 代码中找到 int64FromAny,并追踪其结果如何用于总容量计算。报告显示,UInt64.max 在转换时会导致崩溃,而 Int64(exactly:) 可以避免崩溃;请检查相关测试,或为这个值添加一个针对性测试用例。完成标准是转换不再崩溃,并且无效/未设置标记不会破坏容量总值。
由索引模型根据 Issue 内容生成。
描述
Operating on Nintendo Switch:
System Settings -> Data Management -> Manage Screenshots and Videos -> Copy to a Computer via USB Connection
Log:
private func int64FromAny(_ any: Any?) -> Int64? {
switch any {
case let v as Int64: return v
case let v as UInt64: return Int64(v) <- Thread 1: Fatal error: Not enough bits to represent the passed value
case let v as Int: return Int64(v)
case let v as Double: return Int64(v)
case let v as Float: return Int64(v)
case let v as NSNumber: return v.int64Value
default: return nil
}
}
(lldb) po v
18446744073709551615
After switching to the following approach, it no longer crashes:
case let v as UInt64: return Int64(exactly: v)
The value 18446744073709551615 (UInt64.max) returned by the Nintendo Switch usually indicates an "invalid/unset" marker value, but returning it as such would break the total capacity calculation.
- 主要语言
- Swift
- 星标
- 481
- 派生
- 11
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Neighbor-Z/SwiftMTP 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 64/100
Neighbor-Z/SwiftMTP#22 · 1 条评论 ·
-
难度 3/5 1-2 天 新手友好度 48/100
Neighbor-Z/SwiftMTP#21 · 1 条评论 ·
-
难度 3/5 1-2 天 新手友好度 55/100
Neighbor-Z/SwiftMTP#20 · 2 条评论 ·
-
难度 4/5 1-2 天 新手友好度 48/100
Neighbor-Z/SwiftMTP#17 · 3 条评论 ·
查看 Neighbor-Z/SwiftMTP 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 76/100
openwatersio/slackwater-ios#976 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
difficulty: beginner documentation help wanted networking
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
openwatersio/slackwater#591 ·
维护者通常 1 天内回复