From 7557a4c29ca3ced0be958a634fd04b15dc3ca12b Mon Sep 17 00:00:00 2001 From: Vikram Rangnekar Date: Mon, 15 Jun 2020 10:46:52 -0400 Subject: [PATCH] fix: issue with fragments related crash --- core/internal/qcode/parse.go | 5 +---- core/internal/qcode/qcode.go | 1 + 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/core/internal/qcode/parse.go b/core/internal/qcode/parse.go index 34f8825..3a451c3 100644 --- a/core/internal/qcode/parse.go +++ b/core/internal/qcode/parse.go @@ -440,8 +440,6 @@ func (p *Parser) parseFragmentFields(st *Stack, fields []Field) ([]Field, error) } ff := fr.Fields - parent := &fields[pid] - n := int32(len(fields)) fields = append(fields, ff...) @@ -454,9 +452,8 @@ func (p *Parser) parseFragmentFields(st *Stack, fields []Field) ([]Field, error) // previous field. if f.ParentID == -1 { f.ParentID = pid - if f.ParentID != -1 { - parent.Children = append(parent.Children, f.ID) + fields[pid].Children = append(fields[pid].Children, f.ID) } // Update all the other parents id's by our new place in this new array } else { diff --git a/core/internal/qcode/qcode.go b/core/internal/qcode/qcode.go index 795b0d1..a32157e 100644 --- a/core/internal/qcode/qcode.go +++ b/core/internal/qcode/qcode.go @@ -481,6 +481,7 @@ func (com *Compiler) compileQuery(qc *QCode, op *Operation, role string) error { } qc.Selects = selects[:id] + return nil }