Skip to content

Commit

Permalink
GH-91 Make sure that the input field exists
Browse files Browse the repository at this point in the history
  • Loading branch information
mdziekon committed Jul 27, 2022
1 parent 5d2a95c commit 270de9d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion simulator.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,11 @@ function ($value, $key) use ($TechEquivalents) {
$moraleInputSlots = $_POST[$inputKey];

foreach ($groupFleets as $userSlotIdx => $userFleets) {
$userMoraleLevel = intval($moraleInputSlots[($userSlotIdx + 1)]);
$userMoraleLevel = (
isset($moraleInputSlots[($userSlotIdx + 1)]) ?
intval($moraleInputSlots[($userSlotIdx + 1)]) :
0
);
$userMoraleLevel = keepInRange($userMoraleLevel, -100, 100);

$groupUsersData[$userSlotIdx]['moraleData'] = [
Expand Down

0 comments on commit 270de9d

Please sign in to comment.