Skip to content

Commit 854fe44

Browse files
gavinmakLUCI
authored andcommitted
git_superproject: fix AttributeError in Superproject logging
Ensure _git_event_log is initialized before use in _LogMessage. This avoids crashes when _git_event_log is accessed before it's set, such as during repo info. Bug: 435317391 Change-Id: I3adc32d6a9377558e852bbb43f9cf82041fcf1bc Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/498521 Commit-Queue: Gavin Mak <[email protected]> Tested-by: Gavin Mak <[email protected]> Reviewed-by: Scott Lee <[email protected]>
1 parent d534a55 commit 854fe44

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

git_superproject.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,8 @@ def _LogMessage(self, fmt, *inputs):
190190
message = f"{self._LogMessagePrefix()} {fmt.format(*inputs)}"
191191
if self._print_messages:
192192
print(message, file=sys.stderr)
193-
self._git_event_log.ErrorEvent(message, fmt)
193+
if self._git_event_log:
194+
self._git_event_log.ErrorEvent(message, fmt)
194195

195196
def _LogMessagePrefix(self):
196197
"""Returns the prefix string to be logged in each log message"""

0 commit comments

Comments
 (0)