Skip to content
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

"call of nil" exception when comparing images #8226

Closed
1 task done
saitho opened this issue Sep 18, 2019 · 3 comments · Fixed by #8289
Closed
1 task done

"call of nil" exception when comparing images #8226

saitho opened this issue Sep 18, 2019 · 3 comments · Fixed by #8289
Labels
Milestone

Comments

@saitho
Copy link
Contributor

saitho commented Sep 18, 2019

Description

Opening a pull request that adds or modifies an image works fine.

However in the file view of the pull request an error is thrown:

template: repo/diff/image_diff:14:29: executing "repo/diff/image_diff" at <call .root.FileExistsInBaseCommit .file.OldName>: error calling call: call of nil

@lunny lunny added the type/bug label Sep 18, 2019
@lunny lunny added this to the 1.10.0 milestone Sep 18, 2019
@egrekov
Copy link

egrekov commented Sep 25, 2019

Today I caught a similar error when opening a commit.
template: repo/diff/image_diff:14:29: executing "repo/diff/image_diff" at <call .root.FileExistsInBaseCommit .file.OldName>: error calling call: call of nil

© Gitea Version: 1.10.0+dev-326-gc05b89a5a

@guillep2k
Copy link
Member

guillep2k commented Sep 26, 2019

@saitho The easiest way to reproduce this problem is to check a commit that adds an image. The problem is that the commit URL is: /{user}/{repo}/commit/{commit-sha}, and this routes into:

func Diff(ctx *context.Context) {

Diff() does not set FileExistsInBaseCommit (or other image information), nor calls PrepareCompareDiff(), thus the error.

I've noticed that you've authored #6784 . Is it possible for you to create a new PR fixing this problem?

Perhaps a temporary workaround is to change:

{{if $isImage}}
{{template "repo/diff/image_diff" dict "file" . "root" $}}
{{else}}

Into something like:

{{if and $isImage ($root.FileExistsInBaseCommit != nil)}}
	{{template "repo/diff/image_diff" dict "file" . "root" $}}
{{else}}

Or something around those lines (I'm not quite familiar with macaron syntax).

@saitho
Copy link
Contributor Author

saitho commented Sep 26, 2019

Thanks for your analysis. I added the missing lines (probably lost while rebasing branches) and did some minor adjustments to the image compare functionality. :D

@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants