Finschia / finschia-sdk

A framework for building blockchains based Finschia Mainnet that is forked from cosmos-sdk
Apache License 2.0
61 stars 31 forks source link

fix: add missing nil checks (backport #1299) #1308

Closed mergify[bot] closed 8 months ago

mergify[bot] commented 8 months ago

Description

There are multiple functions in the codebase missing nil checks and this PR fixed them.

This pr cherry-pick the following upstream prs

Motivation and context

How has this been tested?

Screenshots (if appropriate):

Checklist:

mergify[bot] commented 8 months ago

Cherry-pick of a7a39e57060621afb0c346240d204d3cf0687fdc has failed:

On branch mergify/bp/release/v0.48.x/pr-1299
Your branch is up to date with 'origin/release/v0.48.x'.

You are currently cherry-picking commit a7a39e570.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
    modified:   types/coin.go
    modified:   types/coin_test.go
    modified:   types/dec_coin.go
    modified:   types/dec_coin_test.go
    new file:   types/fuzz_test.go

Unmerged paths:
  (use "git add <file>..." to mark resolution)
    both modified:   CHANGELOG.md

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

codecov[bot] commented 8 months ago

Codecov Report

Attention: Patch coverage is 66.66667% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 69.78%. Comparing base (c5fbc74) to head (98d7a10).

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/Finschia/finschia-sdk/pull/1308/graphs/tree.svg?width=650&height=150&src=pr&token=m16qfzIPO7&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Finschia)](https://app.codecov.io/gh/Finschia/finschia-sdk/pull/1308?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Finschia) ```diff @@ Coverage Diff @@ ## release/v0.48.x #1308 +/- ## =================================================== - Coverage 69.79% 69.78% -0.01% =================================================== Files 646 646 Lines 67526 67532 +6 =================================================== + Hits 47127 47129 +2 - Misses 18213 18216 +3 - Partials 2186 2187 +1 ``` | [Files](https://app.codecov.io/gh/Finschia/finschia-sdk/pull/1308?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Finschia) | Coverage Δ | | |---|---|---| | [types/coin.go](https://app.codecov.io/gh/Finschia/finschia-sdk/pull/1308?src=pr&el=tree&filepath=types%2Fcoin.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Finschia#diff-dHlwZXMvY29pbi5nbw==) | `94.62% <100.00%> (+0.03%)` | :arrow_up: | | [types/dec\_coin.go](https://app.codecov.io/gh/Finschia/finschia-sdk/pull/1308?src=pr&el=tree&filepath=types%2Fdec_coin.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Finschia#diff-dHlwZXMvZGVjX2NvaW4uZ28=) | `77.45% <50.00%> (-0.63%)` | :arrow_down: | ... and [1 file with indirect coverage changes](https://app.codecov.io/gh/Finschia/finschia-sdk/pull/1308/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Finschia)
zemyblue commented 8 months ago

There is CI failure. Please check it.

Oh, coverage fail. I think we can skip it in this case.