fix potential null pointer usage as reported by Coverity Prevent

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10608 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2008-06-29 00:50:27 +00:00
commit b02017c658
3 changed files with 16 additions and 12 deletions

View file

@ -167,18 +167,21 @@ static int cparse_template_expand(Node *n, String *tname, String *rname, String
add_parms(Getattr(n, "throws"), cpatchlist, typelist);
} else if (Equal(nodeType, "destructor")) {
String *name = Getattr(n, "name");
if (name && strchr(Char(name), '<')) {
Append(patchlist, Getattr(n, "name"));
} else {
Append(name, templateargs);
if (name) {
if (strchr(Char(name), '<'))
Append(patchlist, Getattr(n, "name"));
else
Append(name, templateargs);
}
name = Getattr(n, "sym:name");
if (name && strchr(Char(name), '<')) {
String *sn = Copy(tname);
Setattr(n, "sym:name", sn);
Delete(sn);
} else {
Replace(name, tname, rname, DOH_REPLACE_ANY);
if (name) {
if (strchr(Char(name), '<')) {
String *sn = Copy(tname);
Setattr(n, "sym:name", sn);
Delete(sn);
} else {
Replace(name, tname, rname, DOH_REPLACE_ANY);
}
}
/* Setattr(n,"sym:name",name); */
Append(cpatchlist, Getattr(n, "code"));