patch 9.1.1518: getcompletiontype() may crash

Problem:  getcompletiontype() crashes when no completion is available
          (after v9.1.1509).
Solution: Don't call set_expand_context() (zeertzjq)

fixes: #17681
closes: #17684

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/cmdexpand.c b/src/cmdexpand.c
index 5fa631c..b7597ea 100644
--- a/src/cmdexpand.c
+++ b/src/cmdexpand.c
@@ -4577,10 +4577,7 @@
 
     cmdline_len = (int)STRLEN(pat);
     set_cmd_context(&xpc, pat, cmdline_len, cmdline_len, FALSE);
-    xpc.xp_pattern_len = (int)STRLEN(xpc.xp_pattern);
-    xpc.xp_col = cmdline_len;
-
-    rettv->vval.v_string = get_cmdline_completion(&xpc);
+    rettv->vval.v_string = cmdcomplete_type_to_str(xpc.xp_context, xpc.xp_arg);
 
     ExpandCleanup(&xpc);
 }