Skip to content

Commit

Permalink
Merge pull request #5 from mewpull/fix-nil-deref-in-assignSingleChild…
Browse files Browse the repository at this point in the history
…Property-new

fix nil-pointer dereference in assignSingleChildProperty
  • Loading branch information
200sc authored Feb 13, 2021
2 parents b22da55 + cb197d1 commit 2a32fd7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,8 @@ func parseVertexDataInner(element *Element, name, idxName string) ([]int, Vertex

func parseTexture(scene *Scene, element *Element) *Texture {
texture := NewTexture(scene, element)
assignSingleChildProperty(element, "FileName", texture.filename)
assignSingleChildProperty(element, "RelativeFilename", texture.relativeFilename)
assignSingleChildProperty(element, "FileName", &texture.filename)
assignSingleChildProperty(element, "RelativeFilename", &texture.relativeFilename)
return texture
}

Expand Down
4 changes: 2 additions & 2 deletions property.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@ func findChildren(element *Element, id string) []*Element {
return []*Element{}
}

func assignSingleChildProperty(element *Element, id string, dv *DataView) bool {
func assignSingleChildProperty(element *Element, id string, dv **DataView) bool {
prop := findSingleChildProperty(element, id)
if prop != nil {
*dv = *prop.value
*dv = prop.value
return true
}
return false
Expand Down

0 comments on commit 2a32fd7

Please sign in to comment.