Go Back   RunUO - Ultima Online Emulation > RunUO > Modification Suggestions

Modification Suggestions This is where you can suggest a modifcation to RunUO!

Reply
 
Thread Tools Display Modes
Old 11-05-2007, 12:01 PM   #1 (permalink)
Forum Expert
 
arul's Avatar
 
Join Date: Jan 2005
Location: Hic sunt leones ...
Age: 21
Posts: 1,280
Send a message via MSN to arul
Default Emitter bug

When you use a sort of 'multi' command with a conditional clause it stops at first erroneous object.

I mean, for example I want to search for all players whose combatant is named "JohnDoe", so I use a command like this

[global interface where playermobile combatant.name = 'JohnDoe'

As soon as I run this command a nullref exception pops out.

The problem is that not every playermobile has a combatant, so their combatant is null, the method call to get_Name fails and an exception is thrown.

I did a little research on this issue:
Code:
  public void FinishCall()
  {
   CallInfo call = m_Calls.Pop();
   if ( ( call.type.IsValueType || call.type.IsByRef ) && call.method.DeclaringType != call.type )
    m_Generator.Emit( OpCodes.Constrained, call.type );
 
   if ( call.method.DeclaringType.IsValueType || call.method.IsStatic )
    m_Generator.Emit( OpCodes.Call, call.method );
   else
    m_Generator.Emit( OpCodes.Callvirt, call.method );
 
   for ( int i = call.parms.Length - 1; i >= 0; --i )
    Pop( call.parms[i].ParameterType );
   if ( ( call.method.CallingConvention & CallingConventions.HasThis ) != 0 )
    Pop( call.method.DeclaringType );
   if ( call.method.ReturnType != typeof( void ) )
    Push( call.method.ReturnType );
  }
The code in red is the problem, it assumes that the TOS contains a reference to an object, which, as mentioned above, is null.
So, my suggestion is to check the TOS for a null value before the Callvirt or implement a different sanity check somewhere else.

EDIT: Removed some code, it didn't work.

It could probably be fixed by a try-catch somewhere where the conditions are interpreted.
__________________
Angels are falling the very last time, down they're burning in hate and decline, unfaithful and violent we're breaking the spell, we're god, we're scissor, in heaven and hell!

Last edited by arul; 11-05-2007 at 01:45 PM.
arul is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5