FleetBuilder better error when origin is invalid
package ogame
import (
+ "errors"
"math"
"time"
)
@@ -153,6 +154,10 @@ func (f *FleetBuilder) FlightTime() (secs, fuel int) {
func (f *FleetBuilder) SendNow() (Fleet, error) {
err := f.b.Tx(func(tx *Prioritize) error {
+ if f.origin == nil {
+ return errors.New("invalid origin")
+ }
+
// Set all ships
if f.allShips {
f.ships, _ = tx.GetShips(f.origin.GetID())
