Skip to content

Commit

Permalink
Sanity check if array key exists
Browse files Browse the repository at this point in the history
  • Loading branch information
meinemitternacht committed Jul 6, 2016
1 parent d215c65 commit c317762
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions includes/classes/FlashCardManager.class.php
Expand Up @@ -1008,19 +1008,26 @@ public function renderFlashCard(){
}
}
else{
if (!$this->loadFlashCardData($this->flashCardArray[$this->currentCard]['uuid'])) {
$output = "We could not load that flash card.";
} else {
if ($this->cardCurrentState == "front") {
$output = '<div id="cardFront" class="cardData">';
$output .= '<span class="text-success">card front</span><br>';
$output .= $this->getFrontText();
$output .= '</div>';
} else {
$output = '<div id="cardBack" class="cardData">';
$output .= '<span class="text-caution">card back</span><br>';
$output .= $this->getBackText();
$output .= '</div>';
if(!isset($this->flashCardArray[$this->currentCard]['uuid'])){
$output = "We could not load that flash card. Try refreshing the page.";
}
else {
if (!$this->loadFlashCardData($this->flashCardArray[$this->currentCard]['uuid'])) {
$output = "We could not load that flash card.";
}
else {
if ($this->cardCurrentState == "front") {
$output = '<div id="cardFront" class="cardData">';
$output .= '<span class="text-success">card front</span><br>';
$output .= $this->getFrontText();
$output .= '</div>';
}
else {
$output = '<div id="cardBack" class="cardData">';
$output .= '<span class="text-caution">card back</span><br>';
$output .= $this->getBackText();
$output .= '</div>';
}
}
}
}
Expand Down

0 comments on commit c317762

Please sign in to comment.