Skip to content

Commit

Permalink
Fix DestroyItem() crash when passing a multi (#506)
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinEady committed Feb 28, 2023
1 parent c6ced9b commit d9fd8d4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion docs/docs.polserver.com/pol100/corechanges.xml
Expand Up @@ -2,9 +2,14 @@
<ESCRIPT>
<header>
<topic>Latest Core Changes</topic>
<datemodified>02-06-2023</datemodified>
<datemodified>02-27-2023</datemodified>
</header>
<version name="POL100.1.0">
<entry>
<date>02-27-2023</date>
<author>Kevin:</author>
<change type="Fixed">DestroyItem(item) will now throw an error if item is a multi.</change>
</entry>
<entry>
<date>02-06-2023</date>
<author>Kevin:</author>
Expand Down
1 change: 1 addition & 0 deletions docs/docs.polserver.com/pol100/uoem.xml
Expand Up @@ -2027,6 +2027,7 @@ const ACTION_REPEAT := 1;</code></explain>
<return>1 if the item was destroyed</return>
<return>0 if the item's destroy script disallowed destruction</return>
<error>"That item is being used."</error>
<error>"That item is a multi. Use uo::DestroyMulti instead."</error>
<error>"Invalid parameter type"</error>
<related>Item</related>
</function>
Expand Down
2 changes: 2 additions & 0 deletions pol-core/doc/core-changes.txt
@@ -1,4 +1,6 @@
-- POL100.1.0 --
02-27-2023 Kevin:
Fixed: DestroyItem(item) will now throw an error if item is a multi.
02-06-2023 Kevin:
Added: HTTPRequest() now accepts a flags parameter. If HTTPREQUEST_EXTENDED_RESPONSE is passed as flags, returns a Dictionary with members: 'status', the numeric HTTP status code; 'statusText', the reason phrase; 'headers', a Dictionary of key-values for each header; 'body', the response text body.
Added: http::WriteStatus(code, reason := "") to change the status of an HTTP response from the web server. If no reason is provided, one will be calculated from the code (if possible). This can only used once before WriteHeader(), WriteHtml(), and WriteHtmlRaw().
Expand Down
2 changes: 2 additions & 0 deletions pol-core/pol/module/uomod.cpp
Expand Up @@ -2887,6 +2887,8 @@ BObjectImp* UOExecutorModule::mf_DestroyItem()
item->gotten_by()->clear_gotten_item();
else if ( item->inuse() && !is_reserved_to_me( item ) )
return new BError( "That item is being used." );
else if ( item->script_isa( POLCLASS_MULTI ) )
return new BError( "That item is a multi. Use uo::DestroyMulti instead." );

const ItemDesc& id = find_itemdesc( item->objtype_ );
if ( !id.destroy_script.empty() )
Expand Down

0 comments on commit d9fd8d4

Please sign in to comment.