Skip to content

Commit

Permalink
Backport: MB-26292 - fts crashes/restarts during indexing
Browse files Browse the repository at this point in the history
Checks added for guarding against the zero value Type crash
Original Fix: 044ec95

Change-Id: I270a47f5b2dff21c7ebcce2f09d5a4a521f0e227
Reviewed-on: http://review.couchbase.org/84207
Well-Formed: Build Bot <build@couchbase.com>
Reviewed-by: Steve Yen <steve.yen@gmail.com>
Tested-by: Sreekanth Sivasankaran
  • Loading branch information
sreekanth-cb authored and Sreekanth Sivasankaran committed Oct 11, 2017
1 parent ab185c3 commit cb43f8c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pindex_bleve_doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,19 @@ func lookupPropertyPath(data interface{}, path string) interface{} {

func lookupPropertyPathPart(data interface{}, part string) interface{} {
val := reflect.ValueOf(data)
if !val.IsValid() {
return nil
}
typ := val.Type()
switch typ.Kind() {
case reflect.Map:
// FIXME can add support for other map keys in the future
if typ.Key().Kind() == reflect.String {
key := reflect.ValueOf(part)
entry := val.MapIndex(key)
if entry.IsValid() {
return entry.Interface()
if key := reflect.ValueOf(part); key.IsValid() {
entry := val.MapIndex(key)
if entry.IsValid() {
return entry.Interface()
}
}
}
case reflect.Struct:
Expand Down

0 comments on commit cb43f8c

Please sign in to comment.