Skip to content

Commit 7bf95da

Browse files
committed
Protection against None values
We default project, version and build to None, but in some parts we assume there aren't None.
1 parent d87e21f commit 7bf95da

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

readthedocs/doc_builder/environments.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ def run_command_class(
481481
log.warning(
482482
LOG_TEMPLATE,
483483
{
484-
'project': self.project.slug,
484+
'project': self.project.slug if self.project else '',
485485
'version': 'latest',
486486
'msg': msg,
487487
}
@@ -570,8 +570,8 @@ def __exit__(self, exc_type, exc_value, tb):
570570
log.info(
571571
LOG_TEMPLATE,
572572
{
573-
'project': self.project.slug,
574-
'version': self.version.slug,
573+
'project': self.project.slug if self.project else '',
574+
'version': self.version.slug if self.version else '',
575575
'msg': 'Build finished',
576576
}
577577
)
@@ -614,9 +614,9 @@ def handle_exception(self, exc_type, exc_value, _):
614614
extra={
615615
'stack': True,
616616
'tags': {
617-
'build': self.build.get('id'),
618-
'project': self.project.slug,
619-
'version': self.version.slug,
617+
'build': self.build.get('id') if self.build else '',
618+
'project': self.project.slug if self.project else '',
619+
'version': self.version.slug if self.version else '',
620620
},
621621
},
622622
)

0 commit comments

Comments
 (0)