about summary refs log tree commit diff stats
path: root/WWW/Library/Implementation/HTAnchor.c
diff options
context:
space:
mode:
Diffstat (limited to 'WWW/Library/Implementation/HTAnchor.c')
-rw-r--r--WWW/Library/Implementation/HTAnchor.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/WWW/Library/Implementation/HTAnchor.c b/WWW/Library/Implementation/HTAnchor.c
index 9e3933ad..9be41d00 100644
--- a/WWW/Library/Implementation/HTAnchor.c
+++ b/WWW/Library/Implementation/HTAnchor.c
@@ -901,11 +901,21 @@ PUBLIC void HTAnchor_setTitle ARGS2(
     int i;
 
     if (me) {
-	StrAllocCopy(me->title, title);
-	for (i = 0; me->title[i]; i++) {
-	    if ((unsigned char)me->title[i] == 1 ||
-		(unsigned char)me->title[i] == 2) {
-		me->title[i] = ' ';
+	if (title) {
+	    StrAllocCopy(me->title, title);
+	    for (i = 0; me->title[i]; i++) {
+		if ((unsigned char)me->title[i] == 1 ||
+		    (unsigned char)me->title[i] == 2) {
+		    me->title[i] = ' ';
+		}
+	    }
+	} else {
+	    CTRACE(tfp,"HTAnchor_setTitle: New title is NULL! ");
+	    if (me->title) {
+		CTRACE(tfp,"Old title was \"%s\".\n", me->title);
+		FREE(me->title);
+	    } else {
+		CTRACE(tfp,"Old title was NULL.\n");
 	    }
 	}
     }