@@ -115,7 +115,7 @@ function parseData2(data) {
115115
116116 //User table
117117 var users = xmlDoc . getElementsByTagName ( "User" ) ;
118- if ( users != null ) {
118+ if ( users != null && users . length > 0 ) {
119119 //Add to filter by options
120120 $ ( '#filterby' ) . append ( $ ( '<option/>' ) . prop ( 'value' , 'Users' ) . text ( 'Users' ) ) ;
121121
@@ -158,7 +158,7 @@ function parseData2(data) {
158158 console . log ( "Starting codes" ) ;
159159 // var codes = codebook[0].getElementsByTagName("Code");
160160 var codes = xmlDoc . getElementsByTagName ( "Code" ) ;
161- if ( codes != null ) {
161+ if ( codes != null && codes . length > 0 ) {
162162 $ ( '#filterby' ) . append ( $ ( '<option/>' ) . prop ( 'value' , 'Codes' ) . text ( 'Codes' ) ) ;
163163
164164 // Check if any codes have a color attribute
@@ -268,7 +268,7 @@ function parseData2(data) {
268268
269269 if ( xmlDoc . getElementsByTagName ( "Sources" ) [ 0 ] ) {
270270 let sources = xmlDoc . getElementsByTagName ( "Sources" ) [ 0 ] . childNodes ;
271- if ( sources != null ) {
271+ if ( sources != null && sources . length > 0 ) {
272272 $ ( '#filterby' ) . append ( $ ( '<option/>' ) . prop ( 'value' , 'Sources' ) . text ( 'Sources' ) ) ;
273273 let sourceBlock = $ ( '<div/>' ) . width ( tableWidth ) . appendTo ( $ ( ".preview" ) ) ;
274274 sourceBlock . append ( $ ( "<h2/>" ) . html ( "Sources" ) ) ;
@@ -334,7 +334,7 @@ function parseData2(data) {
334334
335335 var notes = xmlDoc . getElementsByTagName ( "Note" ) ;
336336
337- if ( notes != null ) {
337+ if ( notes != null && notes . length > 0 ) {
338338 $ ( '#filterby' ) . append ( $ ( '<option/>' ) . prop ( 'value' , 'Notes' ) . text ( 'Notes' ) ) ;
339339 let noteBlock = $ ( '<div/>' ) . width ( tableWidth ) . appendTo ( $ ( ".preview" ) ) ;
340340 noteBlock . append ( $ ( "<h2/>" ) . html ( "Notes" ) ) ;
@@ -387,7 +387,7 @@ function parseData2(data) {
387387 }
388388
389389 let sets = xmlDoc . getElementsByTagName ( "Sets" ) [ 0 ] . childNodes ;
390- if ( sets != null ) {
390+ if ( sets != null && sets . length > 0 ) {
391391 $ ( '#filterby' ) . append ( $ ( '<option/>' ) . prop ( 'value' , 'Sets' ) . text ( 'Sets' ) ) ;
392392 let setBlock = $ ( '<div/>' ) . width ( tableWidth ) . appendTo ( $ ( ".preview" ) ) ;
393393 setBlock . append ( $ ( "<h2/>" ) . html ( "Sets" ) ) ;
@@ -447,7 +447,7 @@ function parseData2(data) {
447447
448448 if ( xmlDoc . getElementsByTagName ( "Graphs" ) [ 0 ] ) {
449449 let graphs = xmlDoc . getElementsByTagName ( "Graphs" ) [ 0 ] . childNodes ;
450- if ( graphs != null ) {
450+ if ( graphs != null && graphs . length > 0 ) {
451451 let graphBlock = $ ( '<div/>' ) . width ( tableWidth ) . appendTo ( $ ( ".preview" ) ) ;
452452 graphBlock . append ( $ ( "<h2/>" ) . html ( "Graphs" ) . append ( $ ( '<span/>' ) . attr ( 'id' , 'reset' ) . text ( 'Reset' ) . addClass ( 'btn btn-default' ) ) ) ;
453453
0 commit comments