Backend for songs.zachdecook.com
* Songs: Fix rendering issue when no chord is found
Zach DeCook 2018-12-27
parent cd1254d · commit 297437f
-rw-r--r--laravel/app/Http/Controllers/SongController.php4
1 files changed, 3 insertions, 1 deletions
diff --git a/laravel/app/Http/Controllers/SongController.php b/laravel/app/Http/Controllers/SongController.php
index 6452f7a..4545896 100644
--- a/laravel/app/Http/Controllers/SongController.php
+++ b/laravel/app/Http/Controllers/SongController.php
@@ -151,7 +151,9 @@ class SongController extends Controller
$chords["Bb"] = $chords["A#"];
$ochords = array( "C","Db","D","Eb","E","F","Gb","G","Ab","A","Bb","B" );
$fromkey = trim($fromkey, 'm');
- return $ochords[($chords[$fromkey] + $integer + 24)%12];
+ if ( isset( $chords[$fromkey] ) ) {
+ return $ochords[($chords[$fromkey] + $integer + 24)%12];
+ } return false;
}
public function post()