fix: powerdrawer plug out of power err

This commit is contained in:
Inanc Gumus
2019-09-27 11:34:02 +03:00
parent 3f653e7209
commit 0127b45c1e

View File

@ -27,7 +27,7 @@ type Socket struct {
func (s *Socket) Plug(device PowerDrawer) error {
n := rand.Intn(50) + 1
if s.power-n <= 0 {
if s.power-n < 0 {
return fmt.Errorf("socket is out of power for %dkW", n)
}