diff options
author | Paul Wise <pabs3@bonedaddy.net> | 2016-08-04 18:24:46 +0800 |
---|---|---|
committer | Paul Wise <pabs3@bonedaddy.net> | 2016-08-04 18:24:46 +0800 |
commit | 529a74a28be43c04840d937c87a5ee3b81133852 (patch) | |
tree | e8609d28c6f7046029e3099052434ff76ed12376 | |
parent | 16a30ece6ab4eaa9ca5d056ada94673265195e27 (diff) | |
download | iotop-529a74a28be43c04840d937c87a5ee3b81133852.tar.gz |
Check the column title is not empty before using it
Fixes crash with terminals that don't fit all titles.
Traceback (most recent call last):
File "./iotop.py", line 12, in <module>
main()
File "./iotop/ui.py", line 669, in main
main_loop()
File "./iotop/ui.py", line 659, in <lambda>
main_loop = lambda: run_iotop(options)
File "./iotop/ui.py", line 554, in run_iotop
return curses.wrapper(run_iotop_window, options)
File "/usr/lib/python3.5/curses/__init__.py", line 94, in wrapper
return func(stdscr, *args, **kwds)
File "./iotop/ui.py", line 546, in run_iotop_window
ui.run()
File "./iotop/ui.py", line 176, in run
self.process_list.duration)
File "./iotop/ui.py", line 515, in refresh_display
self.win.addstr(len_summary, pos, title, attr)
_curses.error: addwstr() returned ERR
-rw-r--r-- | iotop/ui.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/iotop/ui.py b/iotop/ui.py index 30efa73..a957bdd 100644 --- a/iotop/ui.py +++ b/iotop/ui.py @@ -511,7 +511,8 @@ class IOTopUI(object): title += self.sorting_reverse and '>' or '<' title = title[:remaining_cols] remaining_cols -= len(title) - self.win.addstr(len_summary, pos, title, attr) + if title: + self.win.addstr(len_summary, pos, title, attr) pos += len(title) for i in range(num_lines): try: |