diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2013-03-18 14:32:02 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2013-03-18 14:32:02 +0000 |
commit | 972f30762ab2dcbe1f2662b6014f1cfccf56fe16 (patch) | |
tree | e2e91cc5cc088a0667722b0e7a6d2c1d42919337 /plugins/IEView | |
parent | 4ba687b25dd5be4573c98f8f2d07efbfc0919a2a (diff) |
ieview crash fix
git-svn-id: http://svn.miranda-ng.org/main/trunk@4097 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/IEView')
-rw-r--r-- | plugins/IEView/src/TextToken.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/plugins/IEView/src/TextToken.cpp b/plugins/IEView/src/TextToken.cpp index 0c16b6aa55..acddb91263 100644 --- a/plugins/IEView/src/TextToken.cpp +++ b/plugins/IEView/src/TextToken.cpp @@ -578,14 +578,15 @@ TextToken* TextToken::tokenizeChatFormatting(const wchar_t *text) { return firstToken;
}
-wchar_t *TextToken::htmlEncode(const wchar_t *str) {
+wchar_t *TextToken::htmlEncode(const wchar_t *str)
+{
wchar_t *out;
const wchar_t *ptr;
- bool wasSpace;
- int c;
- c = 0;
- wasSpace = false;
+ if (str == NULL)
+ return NULL;
+ int c = 0;
for (ptr=str; *ptr!='\0'; ptr++) {
+ bool wasSpace = false;
if (*ptr==' ' && wasSpace) {
wasSpace = true;
c += 6;
@@ -604,8 +605,8 @@ wchar_t *TextToken::htmlEncode(const wchar_t *str) { }
}
wchar_t *output = new wchar_t[c+1];
- wasSpace = false;
for (out=output, ptr=str; *ptr!='\0'; ptr++) {
+ bool wasSpace = false;
if (*ptr==' ' && wasSpace) {
wcscpy(out, L" ");
out += 6;
@@ -734,16 +735,16 @@ void TextToken::toString(wchar_t **str, int *sizeAlloced) { break;
case BB_IMG:
eText = htmlEncode(wtext);
- if ((Options::getGeneralFlags()&Options::GENERAL_ENABLE_FLASH) && (wcsstr(eText, L".swf")!=NULL)) {
+ if ((Options::getGeneralFlags()&Options::GENERAL_ENABLE_FLASH) && eText != NULL && (wcsstr(eText, L".swf")!=NULL)) {
Utils::appendText(str, sizeAlloced,
L"<div style=\"width: 100%%; border: 0; overflow: hidden;\"><object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" \
codebase=\"http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0\" width=\"100%%\" >\
<param NAME=\"movie\" VALUE=\"%s\"><param NAME=\"quality\" VALUE=\"high\"><PARAM NAME=\"loop\" VALUE=\"true\"></object></div>",
eText);
- } else if ((Options::getGeneralFlags()&Options::GENERAL_ENABLE_PNGHACK) && (wcsstr(eText, L".png")!=NULL)) {
+ } else if ((Options::getGeneralFlags()&Options::GENERAL_ENABLE_PNGHACK) && eText != NULL && (wcsstr(eText, L".png")!=NULL)) {
Utils::appendText(str, sizeAlloced, L"<img class=\"img\" style=\"height:1px;width:1px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%s',sizingMethod='image');\" />", eText);
} else {
- if (wcsncmp(eText, L"http://", 7)) {
+ if (eText != NULL && wcsncmp(eText, L"http://", 7)) {
Utils::appendText(str, sizeAlloced, L"<div style=\"width: 100%%; border: 0; overflow: hidden;\"><img class=\"img\" style=\"width: expression((maxw = this.parentNode.offsetWidth ) > this.width ? 'auto' : maxw);\" src=\"file://%s\" /></div>", eText);
} else {
Utils::appendText(str, sizeAlloced, L"<div style=\"width: 100%%; border: 0; overflow: hidden;\"><img class=\"img\" style=\"width: expression((maxw = this.parentNode.offsetWidth ) > this.width ? 'auto' : maxw);\" src=\"%s\" /></div>", eText);
|