Skip to content

Commit 0ad97ba

Browse files
committed
FIX: don't allow logic as a path part when using to-path
related to: Oldes/Rebol-issues#477
1 parent 2f23220 commit 0ad97ba

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

src/core/t-block.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@
4747
return (num > 0);
4848
}
4949

50-
static void No_Nones(REBVAL *arg) {
50+
static void No_Nones_Or_Logic(REBVAL *arg) {
5151
arg = VAL_BLK_DATA(arg);
5252
for (; NOT_END(arg); arg++) {
53-
if (IS_NONE(arg)) Trap_Arg(arg);
53+
if (IS_NONE(arg) || IS_LOGIC(arg)) Trap_Arg(arg);
5454
}
5555
}
5656

@@ -289,7 +289,7 @@ static void No_Nones(REBVAL *arg) {
289289
if (ANY_BLOCK(arg)) {
290290
len = VAL_BLK_LEN(arg);
291291
if (len > 0 && type >= REB_PATH && type <= REB_LIT_PATH)
292-
No_Nones(arg);
292+
No_Nones_Or_Logic(arg);
293293
ser = Copy_Values(VAL_BLK_DATA(arg), len);
294294
goto done;
295295
}

src/tests/units/series-test.r3

+13
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,19 @@ Rebol [
648648
===end-group===
649649

650650

651+
===start-group=== "TO-*"
652+
653+
--test-- "to-path"
654+
--assert (mold to-path [1 2 3]) = "1/2/3"
655+
--assert (mold to-path [1 none 3]) = "1/none/3"
656+
;@@ https://github.com/Oldes/Rebol-issues/issues/477
657+
--assert error? try [to-path [1 #[none] 3]]
658+
--assert error? try [to-path [1 #[true] 3]]
659+
--assert error? try [to-path [1 #[false] 3]]
660+
661+
===end-group===
662+
663+
651664
;-- VECTOR related tests moved to %vector-test.r3
652665

653666
~~~end-file~~~

0 commit comments

Comments
 (0)