Skip to content

Commit

Permalink
chore: fix setting nil checks
Browse files Browse the repository at this point in the history
  • Loading branch information
boojack committed Jan 18, 2024
1 parent 8738b68 commit f28b654
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions api/v2/memo_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,10 @@ func (s *APIV2Service) getMemoDisplayWithUpdatedTsSettingValue(ctx context.Conte
if err != nil {
return false, errors.Wrap(err, "failed to find system setting")
}
if memoDisplayWithUpdatedTsSetting == nil {
return false, nil
}

memoDisplayWithUpdatedTs := false
if memoDisplayWithUpdatedTsSetting != nil {

Check failure on line 598 in api/v2/memo_service.go

View workflow job for this annotation

GitHub Actions / go-static-checks

nilness: tautological condition: non-nil != nil (govet)
err = json.Unmarshal([]byte(memoDisplayWithUpdatedTsSetting.Value), &memoDisplayWithUpdatedTs)
Expand All @@ -607,6 +611,10 @@ func (s *APIV2Service) getDisablePublicMemosSystemSettingValue(ctx context.Conte
if err != nil {
return false, errors.Wrap(err, "failed to find system setting")
}
if disablePublicMemosSystemSetting == nil {
return false, nil
}

disablePublicMemos := false
err = json.Unmarshal([]byte(disablePublicMemosSystemSetting.Value), &disablePublicMemos)
if err != nil {
Expand Down

0 comments on commit f28b654

Please sign in to comment.