Index: trunk/web/addons/job_monarch/libtoga.php
===================================================================
--- trunk/web/addons/job_monarch/libtoga.php	(revision 300)
+++ trunk/web/addons/job_monarch/libtoga.php	(revision 301)
@@ -526,11 +526,14 @@
 		$cpus = 0;
 
-		foreach( $this->jobs as $jobid=>$jobattrs ) {
-
-			$nodes = count( $jobattrs[nodes] );
-			$ppn = (int) $jobattrs[ppn] ? $jobattrs[ppn] : 1;
-			$mycpus = $nodes * $ppn;
-
-			$cpus = $cpus + $mycpus;
+		if( isset( $this->jobs ) && count( $this->jobs ) > 0 ) {
+
+			foreach( $this->jobs as $jobid=>$jobattrs ) {
+
+				$nodes = count( $jobattrs[nodes] );
+				$ppn = (int) $jobattrs[ppn] ? $jobattrs[ppn] : 1;
+				$mycpus = $nodes * $ppn;
+
+				$cpus = $cpus + $mycpus;
+			}
 		}
 	}
Index: trunk/web/addons/job_monarch/overview.php
===================================================================
--- trunk/web/addons/job_monarch/overview.php	(revision 300)
+++ trunk/web/addons/job_monarch/overview.php	(revision 301)
@@ -376,78 +376,81 @@
 			"return ( \$a > \$b ) ? 1 : -1;" );
 
-        foreach( $jobs as $jobid => $jobattrs ) {
-
-                        $state = $jobattrs[status];
-                        $user = $jobattrs[owner];
-                        $queue = $jobattrs[queue];
-                        $name = $jobattrs[name];
-                        $req_cpu = $jobattrs[requested_time];
-                        $req_memory = $jobattrs[requested_memory];
-
-			if( $state == 'R' )
-				$nodes = count( $jobattrs[nodes] );
-			else
-				$nodes = $jobattrs[nodes];
-
-                        $ppn = (int) $jobattrs[ppn] ? $jobattrs[ppn] : 1;
-                        $cpus = $nodes * $ppn;
-			$queued_time = (int) $jobattrs[queued_timestamp];
-                        $start_time = (int) $jobattrs[start_timestamp];
-			$runningtime = $report_time - $start_time;
-
-			switch( $sortby ) {
-				case "id":
-					$sorted[$jobid] = $jobid;
-					break;
-
-				case "state":
-					$sorted[$jobid] = $state;
-					break;
-
-				case "user":
-					$sorted[$jobid] = $user;
-					break;
-
-				case "queue":
-					$sorted[$jobid] = $queue;
-					break;
-
-				case "name":
-					$sorted[$jobid] = $name;
-					break;
-
-				case "req_cpu":
-					$sorted[$jobid] = timeToEpoch( $req_cpu );
-					break;
-
-				case "req_mem":
-					$sorted[$jobid] = $req_memory;
-					break;
-
-				case "nodes":
-					$sorted[$jobid] = $nodes;
-					break;
-
-				case "cpus":
-					$sorted[$jobid] = $cpus;
-					break;
-
-				case "queued":
-					$sorted[$jobid] = $queued_time;
-					break;
-
-				case "start":
-					$sorted[$jobid] = $start_time;
-					break;
-
-				case "runningtime":
-					$sorted[$jobid] = $runningtime;
-					break;
-
-				default:
-					break;
-
-			}
-        }
+	if( isset( $jobs ) && count( $jobs ) > 0 ) {
+
+		foreach( $jobs as $jobid => $jobattrs ) {
+
+				$state = $jobattrs[status];
+				$user = $jobattrs[owner];
+				$queue = $jobattrs[queue];
+				$name = $jobattrs[name];
+				$req_cpu = $jobattrs[requested_time];
+				$req_memory = $jobattrs[requested_memory];
+
+				if( $state == 'R' )
+					$nodes = count( $jobattrs[nodes] );
+				else
+					$nodes = $jobattrs[nodes];
+
+				$ppn = (int) $jobattrs[ppn] ? $jobattrs[ppn] : 1;
+				$cpus = $nodes * $ppn;
+				$queued_time = (int) $jobattrs[queued_timestamp];
+				$start_time = (int) $jobattrs[start_timestamp];
+				$runningtime = $report_time - $start_time;
+
+				switch( $sortby ) {
+					case "id":
+						$sorted[$jobid] = $jobid;
+						break;
+
+					case "state":
+						$sorted[$jobid] = $state;
+						break;
+
+					case "user":
+						$sorted[$jobid] = $user;
+						break;
+
+					case "queue":
+						$sorted[$jobid] = $queue;
+						break;
+
+					case "name":
+						$sorted[$jobid] = $name;
+						break;
+
+					case "req_cpu":
+						$sorted[$jobid] = timeToEpoch( $req_cpu );
+						break;
+
+					case "req_mem":
+						$sorted[$jobid] = $req_memory;
+						break;
+
+					case "nodes":
+						$sorted[$jobid] = $nodes;
+						break;
+
+					case "cpus":
+						$sorted[$jobid] = $cpus;
+						break;
+
+					case "queued":
+						$sorted[$jobid] = $queued_time;
+						break;
+
+					case "start":
+						$sorted[$jobid] = $start_time;
+						break;
+
+					case "runningtime":
+						$sorted[$jobid] = $runningtime;
+						break;
+
+					default:
+						break;
+
+				}
+		}
+	}
 
 	//uasort( $sorted, $cmp );
