color_inactive might run before readingdata has been fetched
Tara L Andrews [Wed, 20 Jun 2012 14:19:28 +0000 (16:19 +0200)]
stemmaweb/root/js/relationship.js

index 807b5d4..72f83b2 100644 (file)
@@ -136,11 +136,13 @@ function color_inactive ( el ) {
        // If the reading info has any non-disambiguated lexemes, color it yellow;
        // otherwise color it green.
        $(el).attr( {stroke:'green', fill:'#b3f36d'} );
-       $.each( reading_info['lexemes'], function ( idx, lex ) {
-               if( !lex['is_disambiguated'] || lex['is_disambiguated'] == 0 ) {
-                       $(el).attr( {stroke:'orange', fill:'#fee233'} );
-               }
-       });
+       if( reading_info ) {
+               $.each( reading_info['lexemes'], function ( idx, lex ) {
+                       if( !lex['is_disambiguated'] || lex['is_disambiguated'] == 0 ) {
+                               $(el).attr( {stroke:'orange', fill:'#fee233'} );
+                       }
+               });
+       }
 }
 
 function relemmatize () {