return null if file can't be read in documentstore
This commit is contained in:
parent
2158a201ad
commit
8fb7379d71
@ -682,13 +682,13 @@ fn createDocumentFromURI(self: *DocumentStore, uri: Uri, open: bool) error{OutOf
|
||||
const tracy_zone = tracy.trace(@src());
|
||||
defer tracy_zone.end();
|
||||
|
||||
const file_path = URI.parse(self.allocator, uri) catch unreachable;
|
||||
const file_path = URI.parse(self.allocator, uri) catch return null;
|
||||
defer self.allocator.free(file_path);
|
||||
|
||||
var file = std.fs.openFileAbsolute(file_path, .{}) catch unreachable;
|
||||
var file = std.fs.openFileAbsolute(file_path, .{}) catch return null;
|
||||
defer file.close();
|
||||
|
||||
const file_contents = file.readToEndAllocOptions(self.allocator, std.math.maxInt(usize), null, @alignOf(u8), 0) catch unreachable;
|
||||
const file_contents = file.readToEndAllocOptions(self.allocator, std.math.maxInt(usize), null, @alignOf(u8), 0) catch return null;
|
||||
|
||||
return try self.createDocument(uri, file_contents, open);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user