Skip to content

Commit cdf3ff8

Browse files
committed
Check for selected choice variable before attempting to use it
1 parent 5fa15cf commit cdf3ff8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Resources/Views/question.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
@foreach($question->choices as $choice)
1010
<div class="lmc-choice" id="lmc-choice-{{ $choice->id }}">
1111
<input type="radio" class="lmc-choice-input" id="lmc-choice-input-{{ $choice->id }}" name="lmc-question-input-{{ $question->id }}" value="{{ $choice->id }}">
12-
<label class="lmc-choice-label" id="lmc-choice-label-{{ $choice->id }}" for="lmc-choice-input-{{ $choice->id }}" {{ $choice->id == $selectedChoice->id ? 'checked' : '' }}>
12+
<label class="lmc-choice-label" id="lmc-choice-label-{{ $choice->id }}" for="lmc-choice-input-{{ $choice->id }}" {{ ($selectedChoice != null && $choice->id == $selectedChoice->id) ? 'checked' : '' }}>
1313
<span class="lmc-choice-text" id="lmc-choice-text-{{ $choice->id }}">{{ $choice->text }}</span>
1414
<span class="lmc-choice-description" id="lmc-choice-description-{{ $choice->id }}">{{ $choice->description }}</span>
1515
</label>

0 commit comments

Comments
 (0)