Index: /cpp/frams/param/param.cpp
===================================================================
--- /cpp/frams/param/param.cpp	(revision 229)
+++ /cpp/frams/param/param.cpp	(revision 230)
@@ -558,4 +558,31 @@
 //////////////////////////////// PARAM ////////////////////////////////////
 
+#ifdef DEBUG
+void SimpleAbstractParam::sanityCheck(int i)
+{
+ParamEntry *pe=entry(i);
+
+const char* t=pe->type;
+const char* err=NULL;
+
+if (*t=='p')
+	{
+	if (pe->fun1==NULL)
+		err="no procedure defined";
+	}
+else
+	{
+	if (!(pe->flags & PARAM_READONLY))
+		{ //write access
+		if ((pe->fun2==NULL)&&(pe->offset==PARAM_ILLEGAL_OFFSET))
+			err="no field defined (GETONLY without PARAM_READONLY?)";
+		}
+	}
+if (err!=NULL)
+	FMprintf("SimpleAbstractParam","sanityCheck", FMLV_ERROR,
+		 "Invalid ParamEntry for %s.%s (%s)", getName(), pe->id, err);
+}	
+#endif
+
 void *SimpleAbstractParam::getTarget(int i)
 {
@@ -566,6 +593,13 @@
 ///////// get
 
+#ifdef DEBUG
+#define SANITY_CHECK(i) sanityCheck(i)
+#else
+#define SANITY_CHECK(i) 
+#endif
+
 long SimpleAbstractParam::getInt(int i)
 {
+	SANITY_CHECK(i);
 	ExtValue v;
 	ParamEntry *pe = entry(i);
@@ -584,4 +618,5 @@
 double SimpleAbstractParam::getDouble(int i)
 {
+	SANITY_CHECK(i);
 	ExtValue v;
 	ParamEntry *pe = entry(i);
@@ -600,4 +635,5 @@
 SString SimpleAbstractParam::getString(int i)
 {
+	SANITY_CHECK(i);
 	ExtValue v;
 	ParamEntry *pe = entry(i);
@@ -616,4 +652,5 @@
 ExtObject SimpleAbstractParam::getObject(int i)
 {
+	SANITY_CHECK(i);
 	ExtValue v;
 	ParamEntry *pe = entry(i);
@@ -632,4 +669,5 @@
 ExtValue SimpleAbstractParam::getExtValue(int i)
 {
+	SANITY_CHECK(i);
 	ExtValue v;
 	ParamEntry *pe = entry(i);
@@ -651,4 +689,5 @@
 int SimpleAbstractParam::setInt(int i, long x)
 {
+	SANITY_CHECK(i);
 	ExtValue v;
 	ParamEntry *pe = entry(i);
@@ -686,4 +725,5 @@
 int SimpleAbstractParam::setDouble(int i, double x)
 {
+	SANITY_CHECK(i);
 	ExtValue v;
 	ParamEntry *pe = entry(i);
@@ -721,4 +761,5 @@
 int SimpleAbstractParam::setString(int i, const SString& x)
 {
+	SANITY_CHECK(i);
 	ExtValue v;
 	SString vs;
@@ -761,4 +802,5 @@
 int SimpleAbstractParam::setObject(int i, const ExtObject& x)
 {
+	SANITY_CHECK(i);
 	ExtValue v;
 	ParamEntry *pe = entry(i);
@@ -782,4 +824,5 @@
 int SimpleAbstractParam::setExtValue(int i, const ExtValue& x)
 {
+	SANITY_CHECK(i);
 	ParamEntry *pe = entry(i);
 	if (pe->flags&PARAM_READONLY) return PSET_RONLY;
@@ -801,4 +844,5 @@
 void SimpleAbstractParam::call(int i, ExtValue *args, ExtValue *ret)
 {
+	SANITY_CHECK(i);
 	ParamEntry *pe = entry(i);
 	if (!pe) return;
Index: /cpp/frams/param/param.h
===================================================================
--- /cpp/frams/param/param.h	(revision 229)
+++ /cpp/frams/param/param.h	(revision 230)
@@ -157,4 +157,8 @@
 
 	static const char* SERIALIZATION_PREFIX;
+
+#ifdef DEBUG
+	virtual void sanityCheck(int i) {}
+#endif
 };
 
@@ -170,13 +174,19 @@
 #define FIELDOFFSET(_fld_) ((long)((char*)(&((FIELDSTRUCT*)&MakeCodeGuardHappy)->_fld_)-((char*)((FIELDSTRUCT*)&MakeCodeGuardHappy))))
 
+#ifdef DEBUG
+#define PARAM_ILLEGAL_OFFSET ((long)0xdeadbeef)
+#else
+#define PARAM_ILLEGAL_OFFSET 0
+#endif
+
 #define FIELD(_fld_) FIELDOFFSET(_fld_),0,0
 #define LONGOFFSET(_o_) (_o_),0,0
-#define PROCEDURE(_proc_) 0,(void*)PROCOFFSET(_proc_),0
-#define STATICPROCEDURE(_proc_) 0,(void*)STATICPROCOFFSET(_proc_),0
-#define GETSET(_proc_) 0,(void*)GETOFFSET(get_ ## _proc_),(void*)SETOFFSET(set_ ## _proc_)
+#define PROCEDURE(_proc_) PARAM_ILLEGAL_OFFSET,(void*)PROCOFFSET(_proc_),0
+#define STATICPROCEDURE(_proc_) PARAM_ILLEGAL_OFFSET,(void*)STATICPROCOFFSET(_proc_),0
+#define GETSET(_proc_) PARAM_ILLEGAL_OFFSET,(void*)GETOFFSET(get_ ## _proc_),(void*)SETOFFSET(set_ ## _proc_)
 #define GETFIELD(_proc_) FIELDOFFSET(_proc_),(void*)GETOFFSET(get_ ## _proc_),0
 #define SETFIELD(_proc_) FIELDOFFSET(_proc_),0,(void*)SETOFFSET(set_ ## _proc_)
-#define GETONLY(_proc_) 0,(void*)GETOFFSET(get_ ## _proc_),0
-#define SETONLY(_proc_) 0,0,(void*)SETOFFSET(set_ ## _proc_)
+#define GETONLY(_proc_) PARAM_ILLEGAL_OFFSET,(void*)GETOFFSET(get_ ## _proc_),0
+#define SETONLY(_proc_) PARAM_ILLEGAL_OFFSET,0,(void*)SETOFFSET(set_ ## _proc_)
 
 #define PARAMPROCARGS ExtValue* args,ExtValue* ret
@@ -271,4 +281,8 @@
 	virtual void setDefault(bool numericonly = false);
 	virtual void setDefault(int i, bool numericonly = false);
+
+#ifdef DEBUG
+	void sanityCheck(int i);
+#endif
 };
 
