瀏覽代碼

Handle str(SinkConfig()) gracefully

It would've crashed before, but now it returns "No configuration" like
the command shell does.
Clara Hobbs 7 年之前
父節點
當前提交
722782b0b0
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4
    1
      pdbuddy/__init__.py

+ 4
- 1
pdbuddy/__init__.py 查看文件

@@ -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…
取消
儲存