Skip to content

ParseMessage panic: assignment to entry in nil map quickfix v0.6.0 #390

Description

@keith6014

I have some simple code to read a FIX message and I keep getting a ParseMessage Panic.
I placed the byte array in comments so there aren't any rendering issues

package main

import (
	"bytes"
	"fmt"

	"github.com/quickfixgo/quickfix"
)

func main() {

	rawMsg := bytes.NewBufferString("8=FIX.4.29=10435=D34=249=TW52=20140515-19:49:56.65956=ISLD11=10021=140=154=155=TSLA60=00010101-00:00:00.00010=039")
	fmt.Println(rawMsg.Bytes())
//[56 61 70 73 88 46 52 46 50 1 57 61 49 48 52 1 51 53 61 68 1 51 52 61 50 1 52 57 61 84 87 1 53 50 61 50 48 49 52 48 53 49 53 45 49 57 58 52 57 58 53 54 46 54 53 57 1 53 54 61 73 83 76 68 1 49 49 61 49 48 48 1 50 49 61 49 1 52 48 61 49 1 53 52 61 49 1 53 53 61 84 83 76 65 1 54 48 61 48 48 48 49 48 49 48 49 45 48 48 58 48 48 58 48 48 46 48 48 48 1 49 48 61 48 51 57 1]

	var msg quickfix.Message
	err := quickfix.ParseMessage(&msg, rawMsg)
	if err != nil {
		fmt.Println(err)
	}
	fmt.Println("--", msg)
}

The error message is
panic: assignment to entry in nil map

panic: assignment to entry in nil map
  
goroutine 1 [running]:
github.com/quickfixgo/quickfix.(*FieldMap).add(...)
        /Users/ranj/go/pkg/mod/github.com/quickfixgo/quickfix@v0.6.0/field_map.go:208
github.com/quickfixgo/quickfix.ParseMessageWithDataDictionary(0xc000042de8, 0xc0000b0630, 0x0, 0x0, 0x1, 0x171)
        /Users/ranj/go/pkg/mod/github.com/quickfixgo/quickfix@v0.6.0/message.go:158 +0x201
github.com/quickfixgo/quickfix.ParseMessage(...)
        /Users/ranj/go/pkg/mod/github.com/quickfixgo/quickfix@v0.6.0/message.go:120
main.main()
        /Users/ranj/go-fixtest/main.go:16 +0x185
exit status 2

My go.mod looks like this


go 1.12

require (
	github.com/mattn/go-sqlite3 v1.13.0 // indirect
	github.com/quickfixgo/quickfix v0.6.0
	github.com/shopspring/decimal v0.0.0-20191009025716-f1972eb1d1f5 // indirect
	github.com/stretchr/testify v1.4.0
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions