Fix app crash on boolean questions

Fixed a bug which caused an app crash if the user picked the wrong answer on a boolean question.

Based on #4.
This commit is contained in:
luca0N! 2021-03-03 01:38:26 -03:00
parent b8d399e144
commit 007122e4b0
Signed by: luca0N
GPG Key ID: 2E7B4655CF16D7D6
1 changed files with 7 additions and 4 deletions

View File

@ -43,7 +43,7 @@ import com.luca0n.joguitos.pluck.R;
import com.luca0n.joguitos.pluck.activities.TriviaGameActivity;
import com.luca0n.joguitos.pluck.trivia.TriviaQuestion;
import com.luca0n.joguitos.pluck.trivia.TriviaQuestionMultiple;
import com.luca0n.joguitos.pluck.trivia.TriviaQuestionBoolean;
public class TriviaQuestionFragment extends Fragment {
@ -114,6 +114,9 @@ public class TriviaQuestionFragment extends Fragment {
} else {
buttonAnswerTrue.setOnClickListener(listener);
buttonAnswerFalse.setOnClickListener(listener);
boolean correctAnswer = ((TriviaQuestionBoolean) question).checkAnswer("true");
buttonAnswerCorrect = correctAnswer ? buttonAnswerTrue : buttonAnswerFalse;
}
}