Skip to content

Commit ed6448a

Browse files
committed
fix when no sort provided
1 parent 70d7709 commit ed6448a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

ServiceNow/Public/New-ServiceNowQuery.ps1

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,13 @@ function New-ServiceNowQuery {
185185
}
186186

187187
$orderList = $Sort
188-
# see if we're working with 1 array or multidimensional array
189-
# we want multidimensional so convert if not
190-
if ($Sort[0].GetType().Name -eq 'String') {
191-
$orderList = @(, $Sort)
188+
189+
if ( $Sort ) {
190+
# see if we're working with 1 array or multidimensional array
191+
# we want multidimensional so convert if not
192+
if ($Sort[0].GetType().Name -eq 'String') {
193+
$orderList = @(, $Sort)
194+
}
192195
}
193196

194197
$query += for ($i = 0; $i -lt $orderList.Count; $i++) {

0 commit comments

Comments
 (0)