From c421ca0e12a3be6454436237bc0189356c89a43f Mon Sep 17 00:00:00 2001 From: Nicolas MASSE Date: Thu, 9 Dec 2021 21:49:25 +0100 Subject: [PATCH] fix null pointer exception --- main.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index e537a0c..0639746 100644 --- a/main.go +++ b/main.go @@ -219,6 +219,12 @@ func computeRepositoriesToMigrate(gh GHRepositoryList, gt GTRepositoryList) GHRe } func migrate(ghRepo *github.Repository, gtClient *gitea.Client, gtUser *gitea.User) error { + // the description is an optional field + var description string = "" + if ghRepo.Description != nil { + description = *ghRepo.Description + } + migrationOptions := gitea.MigrateRepoOption{ CloneAddr: *ghRepo.CloneURL, AuthUsername: *ghRepo.Owner.Login, @@ -227,7 +233,7 @@ func migrate(ghRepo *github.Repository, gtClient *gitea.Client, gtUser *gitea.Us RepoName: *ghRepo.Name, Mirror: true, Private: *ghRepo.Private, - Description: *ghRepo.Description, + Description: description, } _, err := gtClient.MigrateRepo(migrationOptions) return err