LinkinStars commented on PR #1207: URL: https://github.com/apache/incubator-answer/pull/1207#issuecomment-2560885243
We are almost done. We have tested various scenarios of what might happen. So far, only the following two locations are potentially problematic. ### Add default Operator  ``` runtime/panic.go:785 http: panic serving 127.0.0.1:57957: runtime error: invalid memory address or nil pointer dereference goroutine 39 [running]: net/http.(*conn).serve.func1() go/pkg/mod/golang.org/[email protected]/src/net/http/server.go:1947 +0x118 panic({0x107a03860?, 0x108dd5e50?}) go/pkg/mod/golang.org/[email protected]/src/runtime/panic.go:785 +0xf0 github.com/apache/incubator-answer/internal/service/question_common.(*QuestionCommon).FormatQuestionsPage ``` We can try to add a default operator to solve it. https://github.com/apache/incubator-answer/blob/f7731bc675930f9cb9fa7a6f6346c102246b2c4d/internal/service/question_common/question.go#L385 ```go Operator: &schema.QuestionPageRespOperator{ID: questionInfo.UserID}, ``` ### Checking the ActivityUser ``` http: panic serving 127.0.0.1:58701: runtime error: invalid memory address or nil pointer dereference goroutine 777 [running]: net/http.(*conn).serve.func1() go/pkg/mod/golang.org/[email protected]/src/net/http/server.go:1947 +0xb0 panic({0x102990920?, 0x103d85cb0?}) go/pkg/mod/golang.org/[email protected]/src/runtime/panic.go:785 +0x124 github.com/apache/incubator-answer/internal/repo/activity.(*VoteRepo).setActivityRankToZeroIfUserReachLimit( incubator-answer/internal/repo/activity/vote_repo.go:256 ``` https://github.com/apache/incubator-answer/blob/f7731bc675930f9cb9fa7a6f6346c102246b2c4d/internal/repo/activity/vote_repo.go#L242 Maybe we can add a checking here, such like ```go for _, activity := range op.Activities { if userInfoMapping[activity.ActivityUserID] == nil { continue } ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
