Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'NoneType' object has no attribute 'replace' #31

Closed
arthurlutz opened this issue May 25, 2020 · 1 comment
Closed

AttributeError: 'NoneType' object has no attribute 'replace' #31

arthurlutz opened this issue May 25, 2020 · 1 comment
Labels
C-bug Category: This is a bug

Comments

@arthurlutz
Copy link

Using gmpc and clicking on Database > / > Local media > Release Years it crashed and I get the following in the server logs :

2020-05-25 23:41:07,965 ERROR [10173:MpdSession-15] pykka: Unhandled exception in MpdSession (urn:uuid:1f3967ff-2e48-4119-92ac-11ba6abc40f8):
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pykka/_actor.py", line 193, in _actor_loop
    response = self._handle_receive(envelope.message)
  File "/usr/lib/python3/dist-packages/pykka/_actor.py", line 307, in _handle_receive
    return self.on_receive(message)
  File "/usr/local/lib/python3.7/dist-packages/mopidy_mpd/network.py", line 443, in on_receive
    self.on_line_received(line)
  File "/usr/local/lib/python3.7/dist-packages/mopidy_mpd/session.py", line 32, in on_line_received
    response = self.dispatcher.handle_request(line)
  File "/usr/local/lib/python3.7/dist-packages/mopidy_mpd/dispatcher.py", line 46, in handle_request
    return self._call_next_filter(request, response, filter_chain)
  File "/usr/local/lib/python3.7/dist-packages/mopidy_mpd/dispatcher.py", line 69, in _call_next_filter
    return next_filter(request, response, filter_chain)
  File "/usr/local/lib/python3.7/dist-packages/mopidy_mpd/dispatcher.py", line 77, in _catch_mpd_ack_errors_filter
    return self._call_next_filter(request, response, filter_chain)
  File "/usr/local/lib/python3.7/dist-packages/mopidy_mpd/dispatcher.py", line 69, in _call_next_filter
    return next_filter(request, response, filter_chain)
  File "/usr/local/lib/python3.7/dist-packages/mopidy_mpd/dispatcher.py", line 87, in _authenticate_filter
    return self._call_next_filter(request, response, filter_chain)
  File "/usr/local/lib/python3.7/dist-packages/mopidy_mpd/dispatcher.py", line 69, in _call_next_filter
    return next_filter(request, response, filter_chain)
  File "/usr/local/lib/python3.7/dist-packages/mopidy_mpd/dispatcher.py", line 106, in _command_list_filter
    response = self._call_next_filter(request, response, filter_chain)
  File "/usr/local/lib/python3.7/dist-packages/mopidy_mpd/dispatcher.py", line 69, in _call_next_filter
    return next_filter(request, response, filter_chain)
  File "/usr/local/lib/python3.7/dist-packages/mopidy_mpd/dispatcher.py", line 139, in _idle_filter
    response = self._call_next_filter(request, response, filter_chain)
  File "/usr/local/lib/python3.7/dist-packages/mopidy_mpd/dispatcher.py", line 69, in _call_next_filter
    return next_filter(request, response, filter_chain)
  File "/usr/local/lib/python3.7/dist-packages/mopidy_mpd/dispatcher.py", line 152, in _add_ok_filter
    response = self._call_next_filter(request, response, filter_chain)
  File "/usr/local/lib/python3.7/dist-packages/mopidy_mpd/dispatcher.py", line 69, in _call_next_filter
    return next_filter(request, response, filter_chain)
  File "/usr/local/lib/python3.7/dist-packages/mopidy_mpd/dispatcher.py", line 164, in _call_handler_filter
    response = self._format_response(self._call_handler(request))
  File "/usr/local/lib/python3.7/dist-packages/mopidy_mpd/dispatcher.py", line 178, in _call_handler
    return protocol.commands.call(tokens, context=self.context)
  File "/usr/local/lib/python3.7/dist-packages/mopidy_mpd/protocol/__init__.py", line 212, in call
    return self.handlers[tokens[0]](context, *tokens[1:])
  File "/usr/local/lib/python3.7/dist-packages/mopidy_mpd/protocol/__init__.py", line 189, in validate
    return func(**callargs)
  File "/usr/local/lib/python3.7/dist-packages/mopidy_mpd/protocol/music_db.py", line 389, in lsinfo
    for path, lookup_future in context.browse(uri, recursive=False):
  File "/usr/local/lib/python3.7/dist-packages/mopidy_mpd/dispatcher.py", line 308, in browse
    path = "/".join([base_path, ref.name.replace("/", "")])
AttributeError: 'NoneType' object has no attribute 'replace'
@kingosticks
Copy link
Member

Thanks @arthurlutz. I think this happens for you here with Mopidy-Local when there's something unexpected in the track's date tag. Unexpected in this context seems to be anything except a date string in the format YYYY-MM-DD. I'm not sure why we haven't seen more reports of this issue, it seems to have been there a while.

But we can also fix the more generic case here where we are wrongly assuming the name field always exists, when in fact all fields are optional.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug
Projects
None yet
Development

No branches or pull requests

2 participants