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:
parent
609e24c45f
commit
3859a85900
1 changed files with 4 additions and 2 deletions
|
@ -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 );
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue