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"));

View file

@ -1998,7 +1998,8 @@ public:
if (!(variable_wrapper_flag && i == 0)) {
SwigType *pt = Getattr(p, "type");
String *param_type = NewString("");
last_parm = p;
if (setter_flag)
last_parm = p;
/* Get the C# parameter type */
if ((tm = Getattr(p, "tmap:cstype"))) {

View file

@ -847,7 +847,7 @@ SwigType *SwigType_typedef_qualified(SwigType *t) {
String *result;
int i, len;
if (t && strncmp(Char(t), "::", 2) == 0) {
if (strncmp(Char(t), "::", 2) == 0) {
return Copy(t);
}