macroevolution / bamm

A program for multimodel inference on speciation and trait evolution
GNU General Public License v2.0
33 stars 10 forks source link

Fix "polytomy" msg for trees with dos line endings #84

Closed jonchang closed 10 years ago

jonchang commented 10 years ago

If you have a tree file with dos line endings (xxd tree.tre shows 0d0a), bamm munches the newlines (probably because of getline somewhere) and complains about a polytomy, when in fact the parser has been filled with garbage. See the junk in s in the debugger below, and how i is huge.

Breakpoint 1, Tree::buildTreeFromNewickString (this=0x7fffffffd5b0, ts=
    "(((Polyodon_spathula:50.7052,Psephur"...) at /home/jonchang/bamm/src/Tree.cpp:791
791                             log(Error) << "Tree contains at least one polytomy.\n";
(gdb) info locals
q = 0xc76cf0
s =
    "\r", '\000' <repeats 11 times>"\341, \000\000\220\064j", '\000' <repeats 24 times>...
c = <value optimized out>
i = 306328
readingBL = <value optimized out>
p = <value optimized out>