[LON-CAPA-cvs] cvs: loncom /interface lonnavmaps.pm

matthew lon-capa-cvs@mail.lon-capa.org
Fri, 20 Aug 2004 20:14:27 -0000


matthew		Fri Aug 20 16:14:27 2004 EDT

  Modified files:              
    /loncom/interface	lonnavmaps.pm 
  Log:
  avoid internal server error when get by symb fails to find resource.
  
  
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.276 loncom/interface/lonnavmaps.pm:1.277
--- loncom/interface/lonnavmaps.pm:1.276	Fri Aug 13 18:08:16 2004
+++ loncom/interface/lonnavmaps.pm	Fri Aug 20 16:14:27 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavmaps.pm,v 1.276 2004/08/13 22:08:16 albertel Exp $
+# $Id: lonnavmaps.pm,v 1.277 2004/08/20 20:14:27 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2236,9 +2236,14 @@
 sub getBySymb {
     my $self = shift;
     my $symb = shift;
+
     my ($mapUrl, $id, $filename) = &Apache::lonnet::decode_symb($symb);
     my $map = $self->getResourceByUrl($mapUrl);
-    return $self->getById($map->map_pc() . '.' . $id);
+    my $returnvalue = undef;
+    if (ref($map)) {
+        $returnvalue = $self->getById($map->map_pc() .'.'.$id);
+    }
+    return $returnvalue;
 }
 
 sub getByMapPc {
@@ -2432,6 +2437,7 @@
 
 =cut
 
+
 sub getResourceByUrl {
     my $self = shift;
     my $resUrl = shift;