[503] in BarnOwl Developers

home help back first fref pref prev next nref lref last post

[D-O-H] r625 - in trunk: . owl

daemon@ATHENA.MIT.EDU (nelhage@MIT.EDU)
Thu Oct 29 18:06:51 2009

Resent-From: nelhage@mit.edu
Resent-To: barnowl-dev-mtg@charon.mit.edu
Date: Mon, 19 Feb 2007 19:05:36 -0500
To: dirty-owl-hackers@mit.edu
From: nelhage@MIT.EDU
Reply-To: dirty-owl-hackers@MIT.EDU

Author: nelhage
Date: 2007-02-19 19:05:36 -0500 (Mon, 19 Feb 2007)
New Revision: 625

Modified:
   trunk/
   trunk/owl/perlconfig.c
Log:
 r18970@phanatique:  nelhage | 2007-02-19 19:05:23 -0500
 Don't segfault if we encounter a message type without a corresponding
 perl class.
 



Property changes on: trunk
___________________________________________________________________
Name: svk:merge
   - bb873fd7-8e23-0410-944a-99ec44c633eb:/branches/owl/filter-rewrite:15925
bb873fd7-8e23-0410-944a-99ec44c633eb:/local/d-o-h/trunk:18966
   + bb873fd7-8e23-0410-944a-99ec44c633eb:/branches/owl/filter-rewrite:15925
bb873fd7-8e23-0410-944a-99ec44c633eb:/local/d-o-h/trunk:18970

Modified: trunk/owl/perlconfig.c
===================================================================
--- trunk/owl/perlconfig.c	2007-02-20 00:04:08 UTC (rev 624)
+++ trunk/owl/perlconfig.c	2007-02-20 00:05:36 UTC (rev 625)
@@ -27,7 +27,7 @@
 
 SV *owl_perlconfig_message2hashref(owl_message *m)
 {
-  HV *h;
+  HV *h, *stash;
   SV *hr;
   char *ptr, *blessas, *type;
   int i, j;
@@ -92,7 +92,12 @@
   blessas = owl_sprintf("BarnOwl::Message::%s", type);
 
   hr = sv_2mortal(newRV_noinc((SV*)h));
-  hr = sv_bless(hr, gv_stashpv(blessas,0));
+  stash =  gv_stashpv(blessas,0);
+  if(!stash) {
+    owl_function_error("No such class: %s for message type %s", blessas, owl_message_get_type(m));
+    stash = gv_stashpv("BarnOwl::Message", 1);
+  }
+  hr = sv_bless(hr,stash);
   owl_free(type);
   owl_free(blessas);
   return hr;


home help back first fref pref prev next nref lref last post