diff --git a/openslides/core/static/js/core/pdf.js b/openslides/core/static/js/core/pdf.js index c56ee5be2..f4980aefe 100644 --- a/openslides/core/static/js/core/pdf.js +++ b/openslides/core/static/js/core/pdf.js @@ -410,7 +410,7 @@ angular.module('OpenSlidesApp.core.pdf', []) */ extractLineNumbers = function(element) { var foundLineNumbers = []; - if (element.nodeName == 'SPAN' && element.getAttribute('class').indexOf('os-line-number') > -1) { + if (element.nodeName == 'SPAN' && element.getAttribute('class') && element.getAttribute('class').indexOf('os-line-number') > -1) { foundLineNumbers.push(element.getAttribute('data-line-number')); element.parentNode.removeChild(element); } else { diff --git a/tests/karma/core/pdf.service.test.js b/tests/karma/core/pdf.service.test.js index 2b4807257..c97671b80 100644 --- a/tests/karma/core/pdf.service.test.js +++ b/tests/karma/core/pdf.service.test.js @@ -158,6 +158,17 @@ describe('pdf', function () { "margin": [0,10,0,0] })); expect(JSON.stringify(pdfmake[2])).toBe(emptyline); - }) + }); + + it('does not break with non-line-break SPANs', function () { + var inHtml = "