fix: load default framework for no resource table apk

This commit is contained in:
REAndroid 2023-03-28 07:32:41 -04:00
parent 5d834d9cd7
commit 17042a499f

View File

@ -24,6 +24,7 @@ import com.reandroid.arsc.chunk.TableBlock;
import com.reandroid.arsc.chunk.xml.AndroidManifestBlock; import com.reandroid.arsc.chunk.xml.AndroidManifestBlock;
import com.reandroid.arsc.chunk.xml.ResXmlDocument; import com.reandroid.arsc.chunk.xml.ResXmlDocument;
import com.reandroid.arsc.group.EntryGroup; import com.reandroid.arsc.group.EntryGroup;
import com.reandroid.arsc.util.FrameworkTable;
import com.reandroid.arsc.value.AttributeValue; import com.reandroid.arsc.value.AttributeValue;
import com.reandroid.arsc.value.Value; import com.reandroid.arsc.value.Value;
import com.reandroid.arsc.value.ValueType; import com.reandroid.arsc.value.ValueType;
@ -141,7 +142,8 @@ public class Decoder {
return frameworkApk.getTableBlock(); return frameworkApk.getTableBlock();
} catch (IOException ignored) { } catch (IOException ignored) {
} }
return null; // Should not reach here but to be safe return dummy
return new FrameworkTable();
} }
public static Decoder getNullEntryStoreDecoder(){ public static Decoder getNullEntryStoreDecoder(){
@ -149,8 +151,7 @@ public class Decoder {
return NULL_ENTRY_STORE_DECODER; return NULL_ENTRY_STORE_DECODER;
} }
synchronized (Decoder.class){ synchronized (Decoder.class){
TableBlock tableBlock = new TableBlock(); Decoder decoder = new Decoder(getFramework(), 0x7f);
Decoder decoder = new Decoder(tableBlock, 0x7f);
NULL_ENTRY_STORE_DECODER = decoder; NULL_ENTRY_STORE_DECODER = decoder;
return decoder; return decoder;
} }