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

attempting to write None field (workaround included) #250

Open
IamMusavaRibica opened this issue Jun 18, 2022 · 0 comments
Open

attempting to write None field (workaround included) #250

IamMusavaRibica opened this issue Jun 18, 2022 · 0 comments

Comments

@IamMusavaRibica
Copy link

In packet.py , in write_fields method sometimes the name field will be None and attempting to write it will eventually fail saying NoneType has no attribute 'encode'
This is the workaround I made:

# packet.py line 106
def write_fields(self, packet_buffer):
    # Write the fields comprising the body of the packet (excluding the
    # length, packet ID, compression and encryption) into a PacketBuffer.
    for field in self.definition:  # pylint: disable=not-an-iterable
        for var_name, data_type in field.items():
            data = getattr(self, var_name)  # when var_name is 'name', sometimes returns None
            if data is None: data = 'error'  # added line
            data_type.send_with_context(data, packet_buffer, self.context)

Can someone look up into this?
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant