Skip to content

Commit

Permalink
Merge pull request #7 from Galaco/refactor
Browse files Browse the repository at this point in the history
Fix nil value on search
  • Loading branch information
Galaco authored Dec 21, 2018
2 parents 050dba5 + a903455 commit bb067d5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ func readScope(reader *bufio.Reader, scope *KeyValue) *KeyValue {
if strings.Contains(line, CHAR_ENTER_SCOPE) {
// Scope is opened when the key is read
// There may be situations where there is no key, so we must account for that
subScope := scope.value[len(scope.value)-1].(KeyValue)
scope.value = append(scope.value[:len(scope.value)-1], *readScope(reader, &subScope))
subScope := scope.value[len(scope.value)-1].(*KeyValue)
scope.value = append(scope.value[:len(scope.value)-1], readScope(reader, subScope))
continue
}

Expand All @@ -83,7 +83,7 @@ func readScope(reader *bufio.Reader, scope *KeyValue) *KeyValue {
// This *SHOULD* mean key has children
if len(prop) == 1 {
//Create new scope
kv := KeyValue{
kv := &KeyValue{
key: strings.Replace(prop[0], CHAR_ESCAPE, "", -1),
valueType: ValueArray,
}
Expand Down

0 comments on commit bb067d5

Please sign in to comment.