8000 Fix section index partial NPE by tobiaskohlbau · Pull Request #1890 · google/docsy · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix section index partial NPE #1890

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion layouts/partials/section-index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
{{ $pages = (where $pages "Type" "!=" "search") }}
{{ $pages = (where $pages ".Params.hide_summary" "!=" true) -}}
{{ $pages = (where $pages & 8000 quot;.Parent" "!=" nil) -}}
{{ if and .Parent .Parent.File -}}
{{ $pages = (where $pages ".Parent.File" "!=" nil) -}}
{{ if and $parent $parent.File -}}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After looking at this more closely, it seems to make sense indeed.

Btw, the $parent variable is misnamed, because$parent is set to .Page.

Can we inline the variable instead?

Btw, IMHO .Page cannot be falsy, but .Page.File could be falsy. So the if condition can be simplified.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{{ $pages = (where $pages "Parent.File.UniqueID" "==" $parent.File.UniqueID) -}}
{{ end -}}
{{ if or $parent.Params.no_list (eq (len $pages) 0) -}}
Expand Down
0