Skip to content

Commit

Permalink
adding error handling to type cast
Browse files Browse the repository at this point in the history
  • Loading branch information
SNORRIS721 committed May 8, 2024
1 parent ff456d7 commit 60846b9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion store/file/filestore.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,10 @@ func (store *fileStore) getMessage(seqNum int) (msg []byte, found bool, err erro
if !found {
return
}
msgInfo := msgInfoTemp.(msgDef)
msgInfo, ok := msgInfoTemp.(msgDef)
if !ok {
return nil, true, fmt.Errorf("incorrect msgInfo type while reading file: %s", store.bodyFname)
}

msg = make([]byte, msgInfo.size)
if _, err = store.bodyFile.ReadAt(msg, msgInfo.offset); err != nil {
Expand Down

0 comments on commit 60846b9

Please sign in to comment.