blob: 1e34b3f2e72be14d75285a482a86e3c9b2f2248d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
--- gtk+-2.6.4/gtk/gtkrbtree.c 2004-10-28 18:00:04.000000000 +0300
+++ gtk+-2.6.4/gtk/gtkrbtree.c 2005-04-06 16:19:37.812789944 +0300
@@ -1378,18 +1378,18 @@
g_return_val_if_fail (node != NULL, NULL);
/* Case 1: the node's below us. */
- if (node->right != tree->nil)
+ if (node && node->right != tree->nil)
{
node = node->right;
- while (node->left != tree->nil)
+ while (node && node->left != tree->nil)
node = node->left;
return node;
}
/* Case 2: it's an ancestor */
- while (node->parent != tree->nil)
+ while (node && node->parent != tree->nil)
{
- if (node->parent->right == node)
+ if (node->parent && node->parent->right == node)
node = node->parent;
else
return (node->parent);
@@ -1407,18 +1407,18 @@
g_return_val_if_fail (node != NULL, NULL);
/* Case 1: the node's below us. */
- if (node->left != tree->nil)
+ if (node != NULL && node->left != tree->nil)
{
node = node->left;
- while (node->right != tree->nil)
+ while (node != NULL && node->right != tree->nil)
node = node->right;
return node;
}
/* Case 2: it's an ancestor */
- while (node->parent != tree->nil)
+ while (node != NULL && node->parent != tree->nil)
{
- if (node->parent->left == node)
+ if (node->parent && node->parent->left == node)
node = node->parent;
else
return (node->parent);
|