Fix: FirstOrCreate slice out of bounds error when using 'Assigns' (#4436)
Co-authored-by: Liam Fell <liam@lot.to>
This commit is contained in:
		
							parent
							
								
									dd8bf88eb9
								
							
						
					
					
						commit
						00b252559f
					
				| @ -304,7 +304,7 @@ func (db *DB) FirstOrCreate(dest interface{}, conds ...interface{}) (tx *DB) { | ||||
| 
 | ||||
| 		return tx.Create(dest) | ||||
| 	} else if len(db.Statement.assigns) > 0 { | ||||
| 		exprs := tx.Statement.BuildCondition(tx.Statement.assigns[0], tx.Statement.assigns[1:]...) | ||||
| 		exprs := tx.Statement.BuildCondition(db.Statement.assigns[0], db.Statement.assigns[1:]...) | ||||
| 		assigns := map[string]interface{}{} | ||||
| 		for _, expr := range exprs { | ||||
| 			if eq, ok := expr.(clause.Eq); ok { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 liamrfell
						liamrfell