Commit 39a5fc7b authored by Alexandre Dulaunoy's avatar Alexandre Dulaunoy
Browse files

Bug fixed for empty cvss values

parent 4d5e5f7e
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -82,7 +82,6 @@ class Minimal(API):
    try:
      cve = self.filter_logic(filters, r)
    except Exception as e:
      print(e)
      cve = db.getCVEs(limit=self.args['pageLength'], skip=r)
      errors = True
    return {'filters': filters, 'cve': cve, 'errors': errors}
@@ -142,7 +141,10 @@ class Minimal(API):
  def browse(self, vendor=None):
    try:
      data = self.api_browse(vendor)
      if 'product' in data and 'vendor' in data:
       return render_template('browse.html', product=data["product"], vendor=data["vendor"], minimal=self.minimal)
      else:
       return render_template('error.html', minimal=self.minimal, status={'except':'browse_exception', 'info': 'No CPE'})
    except APIError as e:
      return render_template('error.html', minimal=self.minimal, status={'except':'browse_exception', 'info':e.message})

@@ -166,7 +168,7 @@ class Minimal(API):
    value=self.htmlDecode(value)
    regex = re.compile(re.escape(value), re.I)
    cve=db.via4Linked(key, regex)
    cvssList=[float(x['cvss']) for x in cve if 'cvss' in x]
    cvssList=[float(x['cvss']) for x in cve if x.get('cvss')]
    if cvssList:
        stats={'maxCVSS': max(cvssList), 'minCVSS': min(cvssList),'count':len(cve)}
    else: