brinley / jSignature

jQuery plugin for adding web signature functionality
http://www.unbolt.net/jSignature
694 stars 529 forks source link

jsignature.compressorbase30.js - Uncaught TypeError: Cannot read property 'split' of undefined #125

Open rsdaltx opened 7 years ago

rsdaltx commented 7 years ago

The issue occurs when attempting to decompress a signature with no data.. The fix is to check if "data" has any data before calling uncompressstrokes.

, pluginDecompressor = function(data, formattype, importcallable){
    if (typeof data !== 'string') return
    if (data.substring(0, acceptedformat.length).toLowerCase() === acceptedformat) {
        data = data.substring(acceptedformat.length + 1) // chopping off "," there
    }

--> if (data) importcallable(uncompressstrokes(data)); }

Original Exception from chrome debugger:

Uncaught TypeError: Cannot read property 'split' of undefined at uncompressstrokeleg (http://localhost:51468/content/Scripts/jSignature.CompressorBase30.js:98:23) at uncompressstrokes (http://localhost:51468/content/Scripts/jSignature.CompressorBase30.js:165:11) at HTMLCanvasElement.pluginDecompressor (http://localhost:51468/content/Scripts/jSignature.CompressorBase30.js:179:19) at init.d (http://localhost:51468/content/Scripts/jSignature.js:585:61) at init.$.fn.jSignature (http://localhost:51468/content/Scripts/jSignature.js:708:68) at HTMLDivElement. (:42:19) at Function.each (http://localhost:51468/content/scripts/jquery-1.7.2.min.js:4:14162) at init.each (http://localhost:51468/content/scripts/jquery-1.7.2.min.js:4:10033) at :34:27 at Sys._ScriptLoader._loadScriptsInternal (http://localhost:51468/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=mas…a%3adc7e0bd%3a1569bb5f%3a63b115ed%3a30f1f089%3a490a9d4e%3abd8f85e4:15:4736)