Found with sqlsmith. Minimal test case to reproduce:
create table bug1 (id1 integer, val1 integer);
create table bug2 (id2 integer, val2 integer);
create view vbug as select id1, int4smaller(val1, val2) val12 from bug1 join bug2 on id1 = id2;
create table bug3 (id3 integer);
select * from vbug join bug3 on id3 = val12;
At least, pgqs_resolve_var() doesn't handle get_tle_by_resno() returning NULL.