Răsfoiți Sursa

Better error handling

Zachary Kotlarek 14 ani în urmă
părinte
comite
44a74726ce
2 a modificat fișierele cu 9 adăugiri și 2 ștergeri
  1. 4 1
      dmx/rope.pl
  2. 5 1
      plexMonitor/plexMonitor.pl

+ 4 - 1
dmx/rope.pl

@@ -147,6 +147,9 @@ while (1) {
 
 sub mtime($) {
 	my ($file) = @_;
-	my (undef(), undef(), undef(), undef(), undef(), undef(), undef(), undef(), undef(), $mtime, undef(), undef(), undef()) = stat($file);
+	my $mtime = 0;
+	if (-r $file) {
+		(undef(), undef(), undef(), undef(), undef(), undef(), undef(), undef(), undef(), $mtime, undef(), undef(), undef()) = stat($file);
+	}
 	return $mtime;
 }

+ 5 - 1
plexMonitor/plexMonitor.pl

@@ -96,5 +96,9 @@ exit(0);
 
 sub xbmcHTTP($) {
 	my ($cmd) = @_;
-	return get('http://localhost:3000/xbmcCmds/xbmcHttp?command=' . $cmd);
+	my $data = get('http://localhost:3000/xbmcCmds/xbmcHttp?command=' . $cmd);
+	if (!defined($data)) {
+		$data = '';
+	}
+	return $data;
 }