From e2c3eaaec56d3709e4458e7e3288d1cdb8aedfc2 Mon Sep 17 00:00:00 2001 From: dimitr Date: Thu, 17 May 2012 08:55:30 +0000 Subject: [PATCH] Correction. --- src/jrd/par.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/jrd/par.cpp b/src/jrd/par.cpp index 6efdbbc6bb..cb0fceae6b 100644 --- a/src/jrd/par.cpp +++ b/src/jrd/par.cpp @@ -552,8 +552,10 @@ jrd_nod* PAR_make_field(thread_db* tdbb, CompilerScratch* csb, **************************************/ SET_TDBB(tdbb); - const CompilerScratch::csb_repeat* const tail = CMP_csb_element(csb, context); - const USHORT stream = tail->csb_stream; + if (context >= csb->csb_rpt.getCount() || !(csb->csb_rpt[context].csb_flags & csb_used)) + return NULL; + + const USHORT stream = csb->csb_rpt[context].csb_stream; /* CVC: This is just another case of a custom function that isn't prepared for quoted identifiers and that causes views with fields names like "z x" @@ -564,8 +566,8 @@ jrd_nod* PAR_make_field(thread_db* tdbb, CompilerScratch* csb, mysterious message "cannot access column z x in view VF" when selecting from such view that has field "z x". This closes Firebird Bug #227758. */ // solved by using MetaName& as parameter - AP - jrd_rel* const relation = tail->csb_relation; - jrd_prc* const procedure = tail->csb_procedure; + jrd_rel* const relation = csb->csb_rpt[stream].csb_relation; + jrd_prc* const procedure = csb->csb_rpt[stream].csb_procedure; const SSHORT id = relation ? MET_lookup_field(tdbb, relation, base_field) :