Merge pull request #420 from miaowware/qrzfix

Fixed ?call crash on empty adress fields
This commit is contained in:
0x5c 2021-04-12 10:15:47 -04:00 committed by GitHub
commit c0ad8d1108
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -7,6 +7,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased]
### Added
- Helpful LaTeX hints for rendering errors in `?tex`.
### Fixed
- Bug where `?call` would crash if the found profile only had empty address fields.
## [2.7.0] - 2021-04-03

View File

@ -78,7 +78,7 @@ class QRZCog(commands.Cog):
embed.set_thumbnail(url=data.image.url)
for title, val in qrz_process_info(data).items():
if val is not None:
if val:
embed.add_field(name=title, value=val, inline=True)
await ctx.send(embed=embed)
@ -99,7 +99,11 @@ def qrz_process_info(data: qrztools.QrzCallsignData) -> Dict:
if data.address != qrztools.Address():
state = ", " + data.address.state + " " if data.address.state else ""
address = "\n".join([data.address.attn, data.address.line1, data.address.line2 + state, data.address.zip])
address = "\n".join(
[x for x
in [data.address.attn, data.address.line1, data.address.line2 + state, data.address.zip]
if x]
)
else:
address = None