File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -268,6 +268,11 @@ public virtual int SetValues(params object[] values)
268268 // Allow values array longer than FieldCount, just ignore the extra cells.
269269 int copyLength = ( values . Length > FieldCount ) ? FieldCount : values . Length ;
270270
271+ if ( copyLength == 0 )
272+ {
273+ return 0 ;
274+ }
275+
271276 ExtendedClrTypeCode [ ] typeCodes = new ExtendedClrTypeCode [ copyLength ] ;
272277
273278 // Verify all data values as acceptable before changing current state.
@@ -285,8 +290,8 @@ public virtual int SetValues(params object[] values)
285290 }
286291 }
287292
288- // Now move the data (it'll only throw if someone plays with the values array between
289- // the validation loop and here, or if an invalid UDT was sent) .
293+ // Now move the data. We've already validated the element types above, so this will
294+ // only throw if an invalid UDT was sent.
290295 for ( int i = 0 ; i < copyLength ; i ++ )
291296 {
292297 ValueUtilsSmi . SetCompatibleValueV200 (
You can’t perform that action at this time.
0 commit comments