Skip to content

Commit 246cb1a

Browse files
committed
- fix the bug, passes the test
1 parent 6cb7115 commit 246cb1a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/FieldType/User.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public static function register_field_type(): void {
3939
return null;
4040
}
4141

42-
$values = [];
42+
$values = is_array( $value ) ? $value : [];
4343
if ( ! is_array( $value ) ) {
4444
$values[] = $value;
4545
}
@@ -54,6 +54,10 @@ static function ( $user ) {
5454
$values
5555
);
5656

57+
if ( empty( $value ) ) {
58+
return null;
59+
}
60+
5761
$resolver = new UserConnectionResolver( $root, $args, $context, $info );
5862
return $resolver->set_query_arg( 'include', $value )->set_query_arg( 'orderby', 'include' )->get_connection();
5963
},

0 commit comments

Comments
 (0)