Skip to content

Commit

Permalink
Merge pull request #13 from Salvionied/fix-panicinchange
Browse files Browse the repository at this point in the history
Add Error Handling to prevent Panic on change
  • Loading branch information
Salvionied authored Dec 27, 2023
2 parents 9a40643 + bcab848 commit b520a79
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ApolloBuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -1202,6 +1202,9 @@ func (b *Apollo) addChangeAndFee() (*Apollo, error) {
return b, errors.New("No Remaining UTxOs")
}
sortedUtxos := SortUtxos(b.getAvailableUtxos())
if len(sortedUtxos) == 0 {
return b, errors.New("No Remaining UTxOs")
}
b.preselectedUtxos = append(b.preselectedUtxos, sortedUtxos[0])
b.usedUtxos = append(b.usedUtxos, sortedUtxos[0].GetKey())
return b.addChangeAndFee()
Expand Down

0 comments on commit b520a79

Please sign in to comment.