diff --git a/expected/plpgsql_check_passive.out b/expected/plpgsql_check_passive.out index dbbc7d2..473a3c2 100644 --- a/expected/plpgsql_check_passive.out +++ b/expected/plpgsql_check_passive.out @@ -353,3 +353,9 @@ end; $$ language plpgsql; call proc_test(); drop procedure proc_test(); +-- should not to crash +set plpgsql_check.mode = 'fresh_start'; +do $$ +begin +end; +$$; diff --git a/expected/plpgsql_check_passive_1.out b/expected/plpgsql_check_passive_1.out index 31f45c9..d9c9b6e 100644 --- a/expected/plpgsql_check_passive_1.out +++ b/expected/plpgsql_check_passive_1.out @@ -350,3 +350,9 @@ end; $$ language plpgsql; call proc_test(); drop procedure proc_test(); +-- should not to crash +set plpgsql_check.mode = 'fresh_start'; +do $$ +begin +end; +$$; diff --git a/sql/plpgsql_check_passive.sql b/sql/plpgsql_check_passive.sql index 094a52e..f627802 100644 --- a/sql/plpgsql_check_passive.sql +++ b/sql/plpgsql_check_passive.sql @@ -325,3 +325,10 @@ $$ language plpgsql; call proc_test(); drop procedure proc_test(); + +-- should not to crash +set plpgsql_check.mode = 'fresh_start'; +do $$ +begin +end; +$$; diff --git a/src/check_function.c b/src/check_function.c index 5be61b7..c0a2427 100644 --- a/src/check_function.c +++ b/src/check_function.c @@ -1375,6 +1375,9 @@ plpgsql_check_is_checked(PLpgSQL_function *func) { plpgsql_check_HashEnt *hentry; + if (!func->fn_hashkey) + return false; + hentry = (plpgsql_check_HashEnt *) hash_search(plpgsql_check_HashTable, (void *) func->fn_hashkey, HASH_FIND,