[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/avm2 r9616: Make sure we don't call method
From: |
Tom Stellard |
Subject: |
[Gnash-commit] /srv/bzr/gnash/avm2 r9616: Make sure we don't call methods on undefined objects. |
Date: |
Mon, 13 Oct 2008 13:08:54 +0800 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 9616
committer: Tom Stellard <address@hidden>
branch nick: gnash_dev
timestamp: Mon 2008-10-13 13:08:54 +0800
message:
Make sure we don't call methods on undefined objects.
modified:
libcore/vm/Machine.cpp
=== modified file 'libcore/vm/Machine.cpp'
--- a/libcore/vm/Machine.cpp 2008-10-12 02:44:20 +0000
+++ b/libcore/vm/Machine.cpp 2008-10-13 05:08:54 +0000
@@ -1186,21 +1186,36 @@
case SWF::ABC_ACTION_CALLPROPLEX:
case SWF::ABC_ACTION_CALLPROPVOID:
{
-
+ as_value result;
asName a = pool_name(mStream->read_V32(), mPoolObject);
boost::uint32_t argc = mStream->read_V32();
std::auto_ptr< std::vector<as_value> > args = get_args(argc);
//TODO: If multiname is runtime also pop namespace and/or name
values.
as_value object_val = pop_stack();
- as_object *object = object_val.to_object().get();
- as_value property = object->getMember(a.getGlobalName(),0);
- LOG_DEBUG_AVM("Calling method %s on object
%s",property.toDebugString(),object_val.toDebugString());
- as_environment env = as_environment(_vm);
- as_value result = call_method(property,&env,object,args);
-
- if(opcode == SWF::ABC_ACTION_CALLPROPERTY){
- push_stack(result);
- }
+
+ if(object_val.is_undefined()){
+ LOG_DEBUG_AVM("Can't call a method on an undefined
object.");
+ }
+ else{
+
+ as_object *object = object_val.to_object().get();
+ as_value property =
object->getMember(a.getGlobalName(),0);
+
+ if(!property.is_undefined()){
+ LOG_DEBUG_AVM("Calling method %s on object
%s",property.toDebugString(),object_val.toDebugString());
+ as_environment env = as_environment(_vm);
+ result = call_method(property,&env,object,args);
+
+ }
+ else{
+ LOG_DEBUG_AVM("Method is undefined cannot call
method on object %s",object_val.toDebugString());
+ }
+
+ }
+ if(opcode == SWF::ABC_ACTION_CALLPROPERTY){
+ push_stack(result);
+ }
+
/* int shift = completeName(a, argc);
ENSURE_OBJECT(mStack.top(shift + argc));
as_object *obj = mStack.top(argc + shift).to_object().get();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/avm2 r9616: Make sure we don't call methods on undefined objects.,
Tom Stellard <=