diff --git a/sourcepawn/compiler/sc3.c b/sourcepawn/compiler/sc3.c index 4e6e31f9..e0844c66 100644 --- a/sourcepawn/compiler/sc3.c +++ b/sourcepawn/compiler/sc3.c @@ -384,7 +384,7 @@ static int matchobjecttags(int formaltag, int actualtag, int flags) // Some methodmaps are nullable. The nullable property is inherited // automatically. methodmap_t *map = methodmap_find_by_tag(formaltag); - if (map->nullable) + if (map && map->nullable) return TRUE; error(148, pc_tagname(formaltag)); diff --git a/sourcepawn/compiler/tests/fail-assign-null-to-any.sp b/sourcepawn/compiler/tests/fail-assign-null-to-any.sp new file mode 100644 index 00000000..16be5876 --- /dev/null +++ b/sourcepawn/compiler/tests/fail-assign-null-to-any.sp @@ -0,0 +1,4 @@ +Foo(any foo) {} +public Bar() { + Foo(null); +} diff --git a/sourcepawn/compiler/tests/fail-assign-null-to-any.txt b/sourcepawn/compiler/tests/fail-assign-null-to-any.txt new file mode 100644 index 00000000..cb98bb52 --- /dev/null +++ b/sourcepawn/compiler/tests/fail-assign-null-to-any.txt @@ -0,0 +1 @@ +(3) : error 148: cannot assign null to a non-nullable type