foobuzz / todo

A simple command line todo list manager which can be as powerful as you want it to be.
MIT License
382 stars 45 forks source link

Error in "todo edit" if no or wrong ID #10

Closed dramon closed 6 years ago

dramon commented 6 years ago

In version 3.1.2 i get this errors if there are only two IDs:

[dramon@centos7 ~]$ todo edit 
Traceback (most recent call last):
  File "/usr/local/bin/todo", line 9, in <module>
    load_entry_point('todocli==3.1.2', 'console_scripts', 'todo')()
  File "/usr/local/lib/python3.6/site-packages/todo/todo.py", line 156, in main
    result = dispatch(args, daccess)
  File "/usr/local/lib/python3.6/site-packages/todo/todo.py", line 530, in dispatch
    return handler(args, daccess)
  File "/usr/local/lib/python3.6/site-packages/todo/todo.py", line 361, in edit_task
    tid = args['<id>'][0]
IndexError: list index out of range

[dramon@centos7 ~]$ todo edit 5
Traceback (most recent call last):
  File "/usr/local/bin/todo", line 9, in <module>
    load_entry_point('todocli==3.1.2', 'console_scripts', 'todo')()
  File "/usr/local/lib/python3.6/site-packages/todo/todo.py", line 156, in main
    result = dispatch(args, daccess)
  File "/usr/local/lib/python3.6/site-packages/todo/todo.py", line 530, in dispatch
    return handler(args, daccess)
  File "/usr/local/lib/python3.6/site-packages/todo/todo.py", line 363, in edit_task
    new_content = utils.input_from_editor(task['title'], EDITOR)
TypeError: 'NoneType' object is not subscriptable

I suggest to check if ID is present and valid :)

foobuzz commented 6 years ago

Hello,

Thank you for the report. I fixed both bugs in version 3.1.3