added a tweak to PeerItemOrder GetPrice in order to not crash on nil Purchase

This commit is contained in:
pb 2025-07-10 11:47:54 +02:00
parent 83e590d4e1
commit 98a2359c9d

View File

@ -185,6 +185,11 @@ type PeerItemOrder struct {
} }
func (d *PeerItemOrder) GetPrice(request *tools.APIRequest) (float64, error) { func (d *PeerItemOrder) GetPrice(request *tools.APIRequest) (float64, error) {
/////////// Temporary in order to allow GenerateOrder to complete while billing is still WIP
if d.Purchase == nil {
return 0, nil
}
///////////
var priced *resources.PricedResource var priced *resources.PricedResource
b, _ := json.Marshal(d.Item) b, _ := json.Marshal(d.Item)
err := json.Unmarshal(b, priced) err := json.Unmarshal(b, priced)