Commits

mickael9 committed 4f3ad60

Fix max() error when an empty share is shown

Comments (0)

Files changed (1)

     print('Share: %s (%d file(s)) [%s]' % (share.title or 'Untitled', len(share.files), share.url))
     print('--------------------------------------------------------------------------------')
 
-    max_url = max([len(_.url) for _ in share.files.values()])
+    if share.files:
+        max_url = max([len(_.url) for _ in share.files.values()])
 
-    for file in share.files.values():
-        print('- %s  %s  %s  %s' % (shorten(file.name, 29), humansize(file.size, True), file.url.ljust(max_url), file.readystate))
+        for file in share.files.values():
+            print('- %s  %s  %s  %s' % (shorten(file.name, 29), humansize(file.size, True), file.url.ljust(max_url), file.readystate))
+    else:
+        print('- No files')
+
     print()
 
 def entry_point():
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.