Make string replace op safer

This commit is contained in:
Shane Kilkelly 2018-05-24 11:35:55 +01:00
parent de1f33a720
commit 73a45b15ce

View file

@ -110,7 +110,7 @@ define [
if data.length >= (TWO_MEGABYTES - 200)
$scope.textPreview.shouldShowDots = true
# remove last partial line
data = data.replace(/\n.*$/, '')
data = data?.replace?(/\n.*$/, '')
$scope.textPreview.data = data
$timeout(setHeight, 0)
.catch (error) ->