Author: michael
Date: Tue Feb  2 06:30:13 2010
New Revision: 8444

URL: http://svn.slimdevices.com/jive?rev=8444&view=rev
Log:
Bug: 15533
Description: don't read nil file handle

Modified:
    
7.5/trunk/squeezeplay/src/squeezeplay_fab4/share/applets/SqueezeCenter/SqueezeCenterApplet.lua

Modified: 
7.5/trunk/squeezeplay/src/squeezeplay_fab4/share/applets/SqueezeCenter/SqueezeCenterApplet.lua
URL: 
http://svn.slimdevices.com/jive/7.5/trunk/squeezeplay/src/squeezeplay_fab4/share/applets/SqueezeCenter/SqueezeCenterApplet.lua?rev=8444&r1=8443&r2=8444&view=diff
==============================================================================
--- 
7.5/trunk/squeezeplay/src/squeezeplay_fab4/share/applets/SqueezeCenter/SqueezeCenterApplet.lua
 (original)
+++ 
7.5/trunk/squeezeplay/src/squeezeplay_fab4/share/applets/SqueezeCenter/SqueezeCenterApplet.lua
 Tue Feb  2 06:30:13 2010
@@ -1018,19 +1018,23 @@
        local command = "/bin/ls -A " .. scDrive
        local ls = io.popen(command)
 
-       for line in ls:lines() do
-               local match = string.match(line, "^\.") -- we can quit after 
going through . files
-               if match then
-                       present = string.match(line, "^\.Squeezebox")
-                       if present then
-                               log:warn("squeezeboxDirPresent(), found it: ", 
present)
+       if ls ~= nil then
+
+               for line in ls:lines() do
+                       local match = string.match(line, "^\.") -- we can quit 
after going through . files
+                       if match then
+                               present = string.match(line, "^\.Squeezebox")
+                               if present then
+                                       log:warn("squeezeboxDirPresent(), found 
it: ", present)
+                                       break
+                               end
+                       else
                                break
                        end
-               else
-                       break
-               end
-       end
-       ls:close()
+               end
+               ls:close()
+
+       end
 
        log:warn(scDrive, "/.Squeezebox present: ", present)
 
@@ -1047,13 +1051,17 @@
        local format = nil
        local mount = io.popen("/bin/mount")
 
-       for line in mount:lines() do
-               local dummy = string.match(line, "/dev/" .. devName)
-               if dummy then
-                       format = string.match(line, "type (%w*)")
-               end
-       end
-       mount:close()
+       if mount ~= nil then
+
+               for line in mount:lines() do
+                       local dummy = string.match(line, "/dev/" .. devName)
+                       if dummy then
+                               format = string.match(line, "type (%w*)")
+                       end
+               end
+               mount:close()
+
+       end
 
        if format then
                log:debug("New device: /dev/", devName, " formatted with: ", 
format)

_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/jive-checkins

Reply via email to