summaryrefslogtreecommitdiff
path: root/src/ninep/pane.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/ninep/pane.zig')
-rw-r--r--src/ninep/pane.zig8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/ninep/pane.zig b/src/ninep/pane.zig
index 519e5333..ce246465 100644
--- a/src/ninep/pane.zig
+++ b/src/ninep/pane.zig
@@ -131,8 +131,8 @@ pub fn fileOf(pane: *Pane) ?*panes.File.State {
return if (pane.file) |*f| f else null;
}
-pub fn tagOf(p: *Pardes, pane: *Pane) []const u8 {
- return tagline.tagText(p, p.scratch.allocator(), pane) catch "";
+pub fn tagOf(p: *Pardes, pane: *Pane) error{OutOfMemory}![]const u8 {
+ return tagline.tagText(p, p.scratch.allocator(), pane);
}
pub fn dirtyOf(pane: *const Pane) bool {
@@ -320,7 +320,7 @@ pub fn fileSize(p: *Pardes, id: usize, f: PaneFile) u64 {
// What addr selects, generated by each read: no length, as acme's
// data and xdata have none.
.data, .xdata => 0,
- .tag => tagOf(p, pane).len,
+ .tag => if (tagOf(p, pane)) |tag| tag.len else |_| 0, // a stat's length is a hint: none when the tag cannot be made
.name => nameOf(p, pane).len + 1,
.ctl => ctl: {
var buf: [ctl.pane_text_cap]u8 = undefined;
@@ -374,7 +374,7 @@ pub fn read(p: *Pardes, req: Req, id: usize, pane: *Pane, file: PaneFile) Reply
.body => readBody(p, req, id, pane),
.tag => tag: {
applyTagTruncation(p, pane);
- break :tag tree.window(p, req, tagOf(p, pane));
+ break :tag tree.window(p, req, tagOf(p, pane) catch break :tag Reply.fail(req.tag, E.NOMEM));
},
.ctl => ctl: {
var buf: [ctl.pane_text_cap]u8 = undefined;