diff --git a/client/src/components/ControlPanel.jsx b/client/src/components/ControlPanel.jsx index 9745799..30c8327 100644 --- a/client/src/components/ControlPanel.jsx +++ b/client/src/components/ControlPanel.jsx @@ -5,7 +5,9 @@ import './ControlPanel.css'; function TurtleCard({ turtle, isSelected, onSelect }) { const activeState = turtle.state || turtle.mode || 'idle'; const fuel = turtle.fuel === 'unlimited' ? '∞' : (turtle.fuel || '?'); - const inventoryCount = turtle.inventory?.length || 0; + const inventoryCount = Array.isArray(turtle.inventory) + ? turtle.inventory.length + : (turtle.inventory ? Object.keys(turtle.inventory).length : 0); const displayName = turtle.label || `Turtle ${turtle.turtleID}`; const modeColors = {