fixing runtime crash

This commit is contained in:
2026-06-18 00:16:01 +02:00
parent 8a40ca1678
commit ab84de651a
2 changed files with 4 additions and 2 deletions
+3 -1
View File
@@ -19,7 +19,9 @@ pub fn build(b: *std.Build) void {
}), }),
}); });
example.root_module.addImport("drm", drm); example.root_module.addImport("drm", drm);
b.installArtifact(example); const run_example = b.addRunArtifact(example);
const example_step = b.step("example", "Run example.");
example_step.dependOn(&run_example.step);
const test_exe = b.addTest(.{ .root_module = drm }); const test_exe = b.addTest(.{ .root_module = drm });
const run_tests = b.addRunArtifact(test_exe); const run_tests = b.addRunArtifact(test_exe);
+1 -1
View File
@@ -312,7 +312,7 @@ fn sysfsUeventGet(
var it = std.mem.tokenizeScalar(u8, content, '\n'); var it = std.mem.tokenizeScalar(u8, content, '\n');
while (it.next()) |line| { while (it.next()) |line| {
if (std.mem.eql(u8, line[0..key.len], key) and line[key.len] == '=') { if (line.len > key.len and std.mem.eql(u8, line[0..key.len], key) and line[key.len] == '=') {
return gpa.dupe(u8, line[key.len + 1 ..]); return gpa.dupe(u8, line[key.len + 1 ..]);
} }
} }