Browse Source

Handle str(SinkConfig()) gracefully

It would've crashed before, but now it returns "No configuration" like
the command shell does.
Clara Hobbs 7 years ago
parent
commit
722782b0b0
1 changed files with 4 additions and 1 deletions
  1. 4
    1
      pdbuddy/__init__.py

+ 4
- 1
pdbuddy/__init__.py View File

@@ -221,7 +221,10 @@ class SinkConfig:
221 221
             s += "i: {:.2f} A\n".format(self.i / 1000)
222 222
 
223 223
         # Return all but the last character of s to remove the trailing newline
224
-        return s[:-1]
224
+        if s:
225
+            return s[:-1]
226
+        else:
227
+            return "No configuration"
225 228
 
226 229
     def __eq__(self, other):
227 230
         if isinstance(other, self.__class__):

Loading…
Cancel
Save