Avoid NULL pointer dereferences

svn path=/trunk/netsurf/; revision=9684
This commit is contained in:
John Mark Bell 2009-11-22 13:35:41 +00:00
parent c2fd55cbab
commit 2562f7e8c2

View File

@ -1265,21 +1265,31 @@ void browser_window_find_target_internal(struct browser_window *bw,
return;
depth++;
if (bw->children != NULL) {
for (i = 0; i < (bw->cols * bw->rows); i++) {
if ((bw->children[i].name) &&
(!strcasecmp(bw->children[i].name, target))) {
if ((page == &bw->children[i]) || (depth > *rdepth)) {
(!strcasecmp(bw->children[i].name,
target))) {
if ((page == &bw->children[i]) ||
(depth > *rdepth)) {
*rdepth = depth;
*bw_target = &bw->children[i];
}
}
if (bw->children[i].children)
browser_window_find_target_internal(&bw->children[i],
browser_window_find_target_internal(
&bw->children[i],
target, depth, page,
rdepth, bw_target);
}
}
if (bw->iframes != NULL) {
for (i = 0; i < bw->iframe_count; i++)
browser_window_find_target_internal(&bw->iframes[i],
target, depth, page, rdepth, bw_target);
}
for (i = 0; i < bw->iframe_count; i++)
browser_window_find_target_internal(&bw->iframes[i], target,
depth, page, rdepth, bw_target);
}