                 let characterRange = self.characterRange(forGlyphRange: glyphRange, actualGlyphRange: nil)
 
                 var paragraphStart = 0
-                string.getLineStart(&paragraphStart, end: nil, contentsEnd: nil, for: characterRange)
+                var paragraphEnd = 0
+                string.getLineStart(&paragraphStart, end: &paragraphEnd, contentsEnd: nil, for: characterRange)
 
                 if characterRange.location == paragraphStart {
                     // First line fragment of paragraph (before wrapped text, if any)

                    let paragraphIndex = textStorage.paragraphIndex(at: characterRange.location)
                    let drawnString = String(paragraphIndex + 1) as NSString
                    drawnString.draw(with: gutterRect, options: .usesLineFragmentOrigin, attributes: attributes, context: nil)
                }
            }
        }

            let longestString = String(repeating: "0", count: maximumParagraphDigits) as NSString
            let size = longestString.size(withAttributes: [.font: lineNumberFont])
            lineNumberSize = CGSize(width: ceil(size.width), height: ceil(size.height))

        }

        override func drawBackground(forGlyphRange glyphsToShow: NSRange, at origin: CGPoint) {
