Fix potential crash when printing summary of node_modules.jsb without any packages in it

Former-commit-id: 928957dffcb907f188f097b13f90901f74caab86
This commit is contained in:
Jarred Sumner
2021-08-04 12:30:04 -07:00
parent bff37539b9
commit 5467f2fc1a

View File

@@ -335,7 +335,7 @@ pub const NodeModuleBundle = struct {
}
pub fn printSummary(this: *const NodeModuleBundle) void {
const last = this.bundle.packages.len - 1;
const last = std.math.max(this.bundle.packages.len, 1) - 1;
const indent = comptime " ";
for (this.bundle.packages) |pkg, i| {
const modules = this.bundle.modules[pkg.modules_offset .. pkg.modules_offset + pkg.modules_length];