fix possible null dereference in internal/statements/query.go (#1988)

Make sure that pLimitN is not `nil` before dereferencing the pointer.

Co-authored-by: Andreas Gerstmayr <agerstmayr@redhat.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1988
Co-authored-by: andreasgerstmayr <andreasgerstmayr@noreply.gitea.io>
Co-committed-by: andreasgerstmayr <andreasgerstmayr@noreply.gitea.io>
This commit is contained in:
andreasgerstmayr 2021-07-12 23:51:50 +08:00 committed by Lunny Xiao
parent 394c4e1f17
commit 147328f629
1 changed files with 1 additions and 1 deletions

View File

@ -314,7 +314,7 @@ func (statement *Statement) genSelectSQL(columnStr string, needLimit, needOrderB
fmt.Fprint(&buf, " LIMIT ", *pLimitN)
}
} else if dialect.URI().DBType == schemas.ORACLE {
if statement.Start != 0 || pLimitN != nil {
if statement.Start != 0 && pLimitN != nil {
oldString := buf.String()
buf.Reset()
rawColStr := columnStr