Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DisplaySize in order must be 0 when received string is empty, not MaxInt64 #43

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ereader.go
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ func (o *OpenOrder) read(b *bufio.Reader) (err error) {
if o.Order.StockRangeUpper, err = readFloat(b); err != nil {
return err
}
if o.Order.DisplaySize, err = readInt(b); err != nil {
if o.Order.DisplaySize, err = readIntOrDefaultIfEmpty(b, 0); err != nil {
return err
}
if o.Order.BlockOrder, err = readBool(b); err != nil {
Expand Down
6 changes: 5 additions & 1 deletion wire.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,16 @@ func readStringList(b *bufio.Reader, sep string) (r []string, err error) {
}

func readInt(b *bufio.Reader) (int64, error) {
return readIntOrDefaultIfEmpty(b, math.MaxInt64)
}

func readIntOrDefaultIfEmpty(b *bufio.Reader, defaultIfEmpty int64) (int64, error) {
str, err := readString(b)
if err != nil {
return -1, err
}
if str == "" {
return math.MaxInt64, nil
return defaultIfEmpty, nil
}
i, err := strconv.ParseInt(str, 10, 64)
return i, err
Expand Down