steve8x8 / geotoad

Geocaching query tool written in Ruby
https://buymeacoffee.com/steve8x8
Other
28 stars 8 forks source link

Geotoad 3.23.1 crashes when output format changed? #324

Closed penguinzephyr closed 9 years ago

penguinzephyr commented 9 years ago

First apologies if this is answered somewhere, i had a look but couldnt see it. I have tried both ubuntu and windows builds and both of them crash when you open the output changing option.

This is what i get once i try to change the output format.

List of Output Formats: ( o ) Populating templates from /usr/share/geotoad/lib/../templates ( - ) 49 templates total /usr/share/geotoad/interface/input.rb:607:in showMenu': undefined methodeach' for nil:NilClass (NoMethodError) from /usr/share/geotoad/interface/input.rb:195:in interactive' from /usr/bin/geotoad:96:ingetoptions' from /usr/bin/geotoad:1004:in `

' root@default:~#

Running on ubuntu 14.04.3 LTS server.

Geotoad 3.23.1. Ruby 1.9.3p484

steve8x8 commented 9 years ago

(blushes) This bug must have been in there for quite some time... I could reproduce it, and will address it before the next release. There will also be a patch provided here (when it's nice enough). - Stay tuned! Thanks for reporting! (I admit I don't test the TUI very often...)

steve8x8 commented 9 years ago

Here's the patch (that also enhances the output; if you want to only fix the issue, add the "formatList.sort" line before the "each" loop):

+++ geotoad.myown/interface/input.rb    2015-08-22 16:01:28.373846868 +0200
--- geotoad.trunc/interface/input.rb    2015-08-04 09:57:06.000000000 +0200
@@ -603,15 +603,18 @@
         end

       when '24'
-        puts "List of Output Formats: "
         outputDetails = Output.new
+        puts "List of Output Formats [Extension] {Requirement}: "
+        $validFormats = outputDetails.formatList.sort
         $validFormats.each{ |type|
-          desc = outputDetails.formatDesc(type)
-          req = outputDetails.formatRequirement(type)
+          desc = ""
+          ext  = "[" + outputDetails.formatExtension(type) + "]"
+          desc << outputDetails.formatDesc(type)
+          req  = outputDetails.formatRequirement(type)
           if (req)
-            req = "[" + req + " required]"
+            desc << " {" + req + "}"
           end
-          printf("%-12.12s: %-45.45s %s\n", type, desc, req)
+          printf("%-13.13s%6.6s %s\n", type, ext, desc)
         }

         puts ""
steve8x8 commented 9 years ago

Patch(es) applied to git head, will be part of upcoming release 3.23.2

penguinzephyr commented 9 years ago

Thanks guys, all seems to be fixed. Time to download some caches!