* BUG: Error messages are correctly shown now
* BUG: The Base and Favicon properties do not crash anymore if the matching node is not found.

git-svn-id: svn://localhost/gambas/trunk@5165 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Adrien Prokopowicz 2012-09-14 01:05:13 +00:00
parent 167a8fa4a6
commit f95fed96d8
2 changed files with 26 additions and 9 deletions

View file

@ -136,8 +136,16 @@ Element* HtmlDocument::getFaviconElement()
void HtmlDocument::getGBBase(char *&base, size_t &len)
{
Attribute *attr = getBaseElement()->getAttribute("href", 4);
base = attr->attrValue;
len = attr->lenAttrValue;
if(attr)
{
base = attr->attrValue;
len = attr->lenAttrValue;
}
else
{
base = 0;
len = 0;
}
}
void HtmlDocument::setBase(char *content, size_t len)
@ -148,8 +156,16 @@ void HtmlDocument::setBase(char *content, size_t len)
void HtmlDocument::getGBFavicon(char *&base, size_t &len)
{
Attribute *attr = getFaviconElement()->getAttribute("href", 4);
base = attr->attrValue;
len = attr->lenAttrValue;
if(attr)
{
base = attr->attrValue;
len = attr->lenAttrValue;
}
else
{
base = 0;
len = 0;
}
}
void HtmlDocument::setFavicon(char *content, size_t len)

View file

@ -193,14 +193,16 @@ XMLParseException::XMLParseException(const char *nerror, const char *data, const
memcpy(error, nerror, lenError);
//Parse error : (errorText) !\n Line 123456789 , Column 123456789 : \n (near)
errorWhat = (char*)malloc(61 + lenError + lenNear);
memset(errorWhat, 0, 61 + lenError + lenNear);
sprintf(errorWhat, "Parse error : %s !\n Line %zu , Column %zu : \n %s", error, line, column, near);
errorWhat[60 + lenError + lenNear] = 0;
if(posFailed == 0) return;
if(posFailed > data + lenData || posFailed < data) return;
AnalyzeText(data, lenData, posFailed);
errorWhat = (char*)malloc(61 + lenError + lenNear);
memset(errorWhat, 0, 61 + lenError + lenNear);
sprintf(errorWhat, "Parse error : %s !\n Line %zu , Column %zu : \n %s", error, line, column, near);
errorWhat[60 + lenError + lenNear] = 0;
@ -214,7 +216,6 @@ XMLParseException::~XMLParseException() throw()
void XMLParseException::AnalyzeText(const char *text, const size_t lenText, const char *posFailed) throw()
{
for(const char *pos = text; pos < posFailed; ++pos)
{
++column;