mirror of https://github.com/certusone/dc4bc.git
fix for window title and checking array size
This commit is contained in:
parent
c95c91a54a
commit
7c42e969d1
4
qr/qr.go
4
qr/qr.go
|
@ -93,6 +93,9 @@ func (p *CameraProcessor) ReadQR() ([]byte, error) {
|
|||
if cap(chunks) == 0 {
|
||||
chunks = make([]*chunk, decodedChunk.Total)
|
||||
}
|
||||
if decodedChunk.Index > decodedChunk.Total {
|
||||
return nil, fmt.Errorf("invalid QR-code chunk")
|
||||
}
|
||||
if chunks[decodedChunk.Index] != nil {
|
||||
continue
|
||||
}
|
||||
|
@ -103,6 +106,7 @@ func (p *CameraProcessor) ReadQR() ([]byte, error) {
|
|||
break
|
||||
}
|
||||
}
|
||||
window.SetWindowTitle("QR-code chunks successfully read!")
|
||||
data := make([]byte, 0)
|
||||
for _, c := range chunks {
|
||||
data = append(data, c.Data...)
|
||||
|
|
Loading…
Reference in New Issue