Преглед изворни кода

Autovivification strikes again!

Zachary Kotlarek пре 13 година
родитељ
комит
2769e819b0
1 измењених фајлова са 4 додато и 2 уклоњено
  1. 4 2
      dmx/state.pl

+ 4 - 2
dmx/state.pl

@@ -324,7 +324,9 @@ while (1) {
 
 
 		# We are always either playing or paused if the display is on
 		# We are always either playing or paused if the display is on
 		# When we're playing "Audio" assume we are paused
 		# When we're playing "Audio" assume we are paused
-		if ($files{'PLAYING'}->{'status'} && $files{'PLAYING_TYPE'}->{'status'} ne 'Audio') {
+		if (   (exists($files{'PLAYING'}) && $files{'PLAYING'}->{'status'})
+			&& ((exists($files{'PLAYING_TYPE'}) && $files{'PLAYING_TYPE'}->{'status'} ne 'Audio') || !exists($files{'PLAYING_TYPE'})))
+		{
 			$state = 'PLAY';
 			$state = 'PLAY';
 		} else {
 		} else {
 			$state = 'PAUSE';
 			$state = 'PAUSE';
@@ -337,7 +339,7 @@ while (1) {
 		if ($timeSinceUpdate > $STATE_TIMEOUT) {
 		if ($timeSinceUpdate > $STATE_TIMEOUT) {
 			$state = 'OFF';
 			$state = 'OFF';
 		} elsif ($timeSinceUpdate < $STATE_TIMEOUT) {
 		} elsif ($timeSinceUpdate < $STATE_TIMEOUT) {
-			if ($files{'NO_MOTION'}->{'status'}) {
+			if (exists($files{'NO_MOTION'}) && $files{'NO_MOTION'}->{'status'}) {
 				$state = 'OFF';
 				$state = 'OFF';
 			} else {
 			} else {
 				$state = 'MOTION';
 				$state = 'MOTION';