fix panic when Iterate() fails #2040

Merged
lunny merged 1 commits from daisuzu/xorm:daisuzu-patch-1 into master 2021-09-07 01:23:16 +00:00
Contributor

not to call rows.Err()

not to call `rows.Err()`
daisuzu added 1 commit 2021-09-06 05:15:24 +00:00
All checks were successful
continuous-integration/drone/pr Build is passing
049d42641f
fix panic when `Iterate()` fails
not to call `rows.Err()`
Owner

not to call rows.Err()

Could you explain why change that?

> not to call `rows.Err()` Could you explain why change that?
Author
Contributor

Hi lunny,

If error occurs in L75,
049d42641f/rows.go (L75-L79)

rows.Close() calls rows.Err(),
but rows.rows is nil, so it will be panic.

Hi lunny, If error occurs in L75, https://gitea.com/xorm/xorm/src/commit/049d42641f1696958b7b3e4363ed718712570d50/rows.go#L75-L79 `rows.Close()` calls `rows.Err()`, but `rows.rows` is nil, so it will be panic.
lunny approved these changes 2021-09-07 01:23:12 +00:00
lunny merged commit 78309606d4 into master 2021-09-07 01:23:16 +00:00
Owner

Hi lunny,

If error occurs in L75,
049d42641f/rows.go (L75-L79)

rows.Close() calls rows.Err(),
but rows.rows is nil, so it will be panic.

Thanks!

> Hi lunny, > > If error occurs in L75, > https://gitea.com/xorm/xorm/src/commit/049d42641f1696958b7b3e4363ed718712570d50/rows.go#L75-L79 > > `rows.Close()` calls `rows.Err()`, > but `rows.rows` is nil, so it will be panic. Thanks!
lunny added the
kind
bug
label 2021-09-07 01:23:35 +00:00
lunny added this to the 1.3.0 milestone 2021-09-07 01:23:41 +00:00
Author
Contributor

Thank you very much.

Thank you very much.
Sign in to join this conversation.
No description provided.