Skip to content

Commit

Permalink
fix: handle nil pointer dereference
Browse files Browse the repository at this point in the history
  • Loading branch information
deluan committed Feb 28, 2020
1 parent 876354e commit 65a792b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion persistence/sql_base_repository.go
Expand Up @@ -99,8 +99,11 @@ func (r sqlRepository) executeSQL(sq Sqlizer) (int64, error) {
return 0, err
}
start := time.Now()
var c int64
res, err := r.ormer.Raw(query, args...).Exec()
c, _ := res.RowsAffected()
if res != nil {
c, _ = res.RowsAffected()
}
r.logSQL(query, args, err, c, start)
if err != nil {
if err.Error() != "LastInsertId is not supported by this driver" {
Expand Down

0 comments on commit 65a792b

Please sign in to comment.