Commits

mickael9 committed 4f3ad60

Fix max() error when an empty share is shown

  • Participants
  • Parent commits 5e4bc5a

Comments (0)

Files changed (1)

File gett_uploader.py

     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():