From 4c78ce6e3f2b6a18e7ca947bb0c0b467292c47ee Mon Sep 17 00:00:00 2001 From: John Guo Date: Tue, 2 Mar 2021 23:27:50 +0800 Subject: [PATCH] fix issue #1187 --- database/gdb/gdb_type_result_scanlist.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/database/gdb/gdb_type_result_scanlist.go b/database/gdb/gdb_type_result_scanlist.go index b18f23891..521c32b04 100644 --- a/database/gdb/gdb_type_result_scanlist.go +++ b/database/gdb/gdb_type_result_scanlist.go @@ -272,6 +272,10 @@ func (r Result) ScanList(listPointer interface{}, bindToAttrName string, relatio return gerror.Newf(`invalid relation specified: "%v"`, relationKV) } } else { + if i >= len(r) { + // There's no relational data. + continue + } v := r[i] if v == nil { // There's no relational data. @@ -300,6 +304,10 @@ func (r Result) ScanList(listPointer interface{}, bindToAttrName string, relatio return gerror.Newf(`invalid relation specified: "%v"`, relationKV) } } else { + if i >= len(r) { + // There's no relational data. + continue + } relationDataItem := r[i] if relationDataItem == nil { // There's no relational data.