Only get filename if there is an issue

pull/216/head
Joran Honig 7 years ago
parent fecf061d3d
commit 2a1693123f
  1. 8
      mythril/analysis/report.py

@ -51,7 +51,7 @@ class Report:
self.issues[m.digest()] = issue
def as_text(self):
filename = list(self.issues.values())[0].filename
filename = self._file_name()
template = Report.environment.get_template('report_as_text.jinja2')
return template.render(filename=filename, issues=self.issues, verbose=self.verbose)
@ -61,6 +61,10 @@ class Report:
return json.dumps(result)
def as_markdown(self):
filename = list(self.issues.values())[0].filename
filename = self._file_name()
template = Report.environment.get_template('report_as_markdown.jinja2')
return template.render(filename=filename, issues=self.issues, verbose=self.verbose)
def _file_name(self):
if len(self.issues.values()) > 0:
return list(self.issues.values())[0].filename

Loading…
Cancel
Save