adiwg / mdTranslator

Metadata translation tool built using Ruby
https://www.adiwg.org/mdTranslator/
The Unlicense
14 stars 12 forks source link

Error in html writer when topologyLevel is null #152

Closed jlblcc closed 6 years ago

jlblcc commented 6 years ago

Just need to check topologyLevel before running text!. Problem mainly when translating from FGDC. See: https://github.com/adiwg/mdTranslator/blob/master/lib/adiwg/mdtranslator/writers/html/sections/html_vectorRepresentation.rb#L27

Since this seems to be an on-going issue, I'm wondering if we shouldn't extend Builder::XmlMarkup with a textIf! method that checks for a null value before calling text!?

jlblcc commented 6 years ago

Example FGDC XML that fails

stansmith907 commented 6 years ago

I reviewed all 80+ html writer modules and found a few more instances of writes not testing for nil values. Most were required fields such as a keywordObject with no keyword, but set checks around these anyway. The only exception is contactId. contactId is used in creating hyperlinks within the html document thus a nil contactId is going to create problems beyond just a crashing text field.