eclipse plugin: In case the file doesn't contain any WML code,

the resource won't contain any nodes.  In this case, just return an
empty root.
This commit is contained in:
Timotei Dolean 2011-07-30 07:57:52 +00:00
parent 609e24c45f
commit 3859a85900

View file

@ -58,6 +58,7 @@ import org.wesnoth.templates.TemplateProvider;
import org.wesnoth.wml.SimpleWMLParser;
import org.wesnoth.wml.WMLMacroCall;
import org.wesnoth.wml.WMLRoot;
import org.wesnoth.wml.WmlFactory2;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
@ -559,8 +560,9 @@ public class ResourceUtils
ResourceSet resourceSet = new ResourceSetImpl( );
Resource resource = resourceSet.getResource( uri, true );
if ( resource == null ||
resource.getContents( ).isEmpty( ) )
return null;
resource.getContents( ).isEmpty( ) ) {
return WmlFactory2.eINSTANCE.createWMLRoot( );
}
EObject result = resource.getContents( ).get( 0 );