summaryrefslogtreecommitdiff
path: root/src/pdf_view.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-30 20:03:22 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:17 -0300
commit30378c63d752bf27d44f6a64738bab5a2cddc863 (patch)
tree4ae24379c643faafbaff1d5fecdedae63e61785b /src/pdf_view.zig
parent741d088c60da40fd811dedc80d8e62753959bfea (diff)
downloadpardes-30378c63d752bf27d44f6a64738bab5a2cddc863.tar.gz
pardes-30378c63d752bf27d44f6a64738bab5a2cddc863.zip
PdfSections on a PDF with no outline says so, "this PDF has no outline", rather than open an empty +PdfSections
An empty pane with no word of why read as a failure to load, and was kept to be re-shown on the next press. With no outline there is nothing to list: the press is refused with the reason, and a read or slot failure is said too, where it returned silently. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/pdf_view.zig')
-rw-r--r--src/pdf_view.zig9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/pdf_view.zig b/src/pdf_view.zig
index e435d777..6c137202 100644
--- a/src/pdf_view.zig
+++ b/src/pdf_view.zig
@@ -2008,11 +2008,16 @@ pub fn openSections(core: *pardes.Pardes, id: usize) void {
const pane = core.panes[id] orelse return;
const state = &(pane.pdf orelse return);
if (rearmCleanSections(core, id, pane, state)) return;
- const content = state.renderSections(core.pdf_gpa, core.gpa) catch return;
+ const content = state.renderSections(core.pdf_gpa, core.gpa) catch |err| return core.reportError(id, "PdfSections", err);
+ // No outline: said, not an empty pane to puzzle over.
+ if (content.len == 0) {
+ core.gpa.free(content);
+ return core.reportFailure(id, "PdfSections: this PDF has no outline");
+ }
const free = core.freeSlot() orelse {
core.gpa.free(content);
- return;
+ return core.reportError(id, "PdfSections", error.NoPaneSlots);
};
const dir = std.fs.path.dirname(state.path) orelse "/";
const result = Output.open(