From 6ec27f00e28b9a2c01f865fc6d27eb21338bd38a Mon Sep 17 00:00:00 2001
From: Per Hedbor <ph@opera.com>
Date: Thu, 5 Dec 1996 04:23:48 +0100
Subject: [PATCH] Made 0->Foo return special error message

Rev: src/ChangeLog:1.33
Rev: src/interpret.c:1.16
---
 src/ChangeLog   |  5 +++++
 src/interpret.c | 17 +++++++++++++----
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index 01da6eea9f..54d89cb58c 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+Thu Dec  5 04:18:41 1996  Per Hedbor  <per@puck.infovav.se>
+
+	* interpret.c (lvalue_to_svalue_no_free): Added special error
+	message for indexing of 0.
+
 Wed Dec  4 16:33:53 1996  Fredrik Hubinette  <hubbe@cytocin.hubbe.net>
 
 	* callback.c: fixed a memory leak and added more debug
diff --git a/src/interpret.c b/src/interpret.c
index 1cb4bc837b..4ba4882ba9 100644
--- a/src/interpret.c
+++ b/src/interpret.c
@@ -4,7 +4,7 @@
 ||| See the files COPYING and DISCLAIMER for more information.
 \*/
 #include "global.h"
-RCSID("$Id: interpret.c,v 1.15 1996/12/03 21:41:18 hubbe Exp $");
+RCSID("$Id: interpret.c,v 1.16 1996/12/05 03:23:48 per Exp $");
 #include "interpret.h"
 #include "object.h"
 #include "program.h"
@@ -192,7 +192,10 @@ void lvalue_to_svalue_no_free(struct svalue *to,struct svalue *lval)
     break;
     
   default:
-    error("Indexing a basic type.\n");
+   if(IS_ZERO(lval))
+     error("Indexing the NULL value.\n"); /* Per */
+   else
+     error("Indexing a basic type.\n");
   }
 }
 
@@ -228,7 +231,10 @@ void assign_lvalue(struct svalue *lval,struct svalue *from)
     break;
     
   default:
-    error("Indexing a basic type.\n");
+   if(IS_ZERO(lval))
+     error("Indexing the NULL value.\n"); /* Per */
+   else
+     error("Indexing a basic type.\n");
   }
 }
 
@@ -256,7 +262,10 @@ union anything *get_pointer_if_this_type(struct svalue *lval, TYPE_T t)
   case T_MULTISET: return 0;
 
   default:
-    error("Indexing a basic type.\n");
+    if(IS_ZERO(lval))
+      error("Indexing the NULL value.\n"); /* Per */
+    else
+      error("Indexing a basic type.\n");
     return 0;
   }
 }
-- 
GitLab