handle undefined values

This commit fixes an issue for me, that occurs kind of randomly.
I guess this is not the best fix for this problem, but at least it works for me ;)

Error:
"TypeError: value is undefined" in line 448 (var output = value.replace(replaceReg, replaceFunc);
) in text.js

Steps to reproduce:
Call editor.setValue(result); multiple times with only a short time between the calls.
der result variable is a rather long text

When I am calling the SetValue Method a couple of times, at some point (after 10-50 times) the value becomes undefined, normally 2 times for one editor.setValue(result) call.

I have no clue why this happens, but this fix ignores the undefined values and it has no effects on the rendering (it renders all elements) and  i have found so side effects so far.

This problem occurs in Firefox as well in Chrome (latest versions).