Merge change 24047 into eclair
* changes: ADT: fix an NPE that can happen when an XML file resource is being refreshed by Eclipse whilst the SDK is not finished loading.
This commit is contained in:
@@ -77,13 +77,16 @@ public class XmlEditor extends AndroidEditor {
|
||||
IProject project = file.getProject();
|
||||
IAndroidTarget target = Sdk.getCurrent().getTarget(project);
|
||||
if (target != null) {
|
||||
// Note: the target data can be null when an SDK is not finished loading yet.
|
||||
// We can potentially arrive here when Eclipse is started with a file previously
|
||||
// open and the resource gets refreshed -- at that point we may not have the SDK yet.
|
||||
AndroidTargetData data = Sdk.getCurrent().getTargetData(target);
|
||||
|
||||
FirstElementParser.Result result = FirstElementParser.parse(
|
||||
file.getLocation().toOSString(),
|
||||
SdkConstants.NS_RESOURCES);
|
||||
|
||||
if (result != null) {
|
||||
if (result != null && data != null) {
|
||||
String name = result.getElement();
|
||||
if (name != null && result.getXmlnsPrefix() != null) {
|
||||
DocumentDescriptor desc = data.getXmlDescriptors().getDescriptor();
|
||||
|
||||
Reference in New Issue
Block a user