Skip to content

Commit 5aeb29f

Browse files
committed
prevent panic
Signed-off-by: Andrew Thornton <[email protected]>
1 parent 807d110 commit 5aeb29f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

modules/repository/repo.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,14 @@ func MigrateRepositoryGitData(ctx context.Context, u *models.User, repo *models.
9696
}
9797
}
9898

99+
if repo.OwnerID == u.ID {
100+
repo.Owner = u
101+
}
102+
103+
if err = repo.GetOwner(); err != nil {
104+
return repo, fmt.Errorf("unable to get owner[%d] for repo [%d]. Error: %v", repo.OwnerID, repo.ID, err)
105+
}
106+
99107
if err = repo.CheckDaemonExportOK(); err != nil {
100108
return repo, fmt.Errorf("checkDaemonExportOK: %v", err)
101109
}

0 commit comments

Comments
 (0)