mirror of
https://github.com/ziglang/zig.git
synced 2026-02-14 21:38:33 +00:00
main: avoid sending an empty file system inputs message
When all compiler inputs are invalid paths, there could be errors yet no valid file system inputs. Closes #20713
This commit is contained in:
parent
f4f5b2bc41
commit
18685e928d
14
src/main.zig
14
src/main.zig
@ -4207,13 +4207,17 @@ fn serve(
|
||||
fn serveUpdateResults(s: *Server, comp: *Compilation) !void {
|
||||
const gpa = comp.gpa;
|
||||
|
||||
if (comp.file_system_inputs) |file_system_inputs| {
|
||||
assert(file_system_inputs.items.len > 0);
|
||||
try s.serveStringMessage(.file_system_inputs, file_system_inputs.items);
|
||||
}
|
||||
|
||||
var error_bundle = try comp.getAllErrorsAlloc();
|
||||
defer error_bundle.deinit(gpa);
|
||||
|
||||
if (comp.file_system_inputs) |file_system_inputs| {
|
||||
if (file_system_inputs.items.len == 0) {
|
||||
assert(error_bundle.errorMessageCount() > 0);
|
||||
} else {
|
||||
try s.serveStringMessage(.file_system_inputs, file_system_inputs.items);
|
||||
}
|
||||
}
|
||||
|
||||
if (error_bundle.errorMessageCount() > 0) {
|
||||
try s.serveErrorBundle(error_bundle);
|
||||
return;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user