Merge pull request #32752 from m4gr3d/clean_metadata_parsing_fix

Cleanup fix for the meta-data parsing crashing bug.
This commit is contained in:
Rémi Verschelde 2019-10-11 20:46:49 +02:00 committed by GitHub
commit 74ab8be57a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 12 deletions

View File

@ -766,17 +766,9 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
uint32_t attr_value = decode_uint32(&p_manifest[iofs + 8]); uint32_t attr_value = decode_uint32(&p_manifest[iofs + 8]);
uint32_t attr_resid = decode_uint32(&p_manifest[iofs + 16]); uint32_t attr_resid = decode_uint32(&p_manifest[iofs + 16]);
String value; const String value = (attr_value != 0xFFFFFFFF) ? string_table[attr_value] : "Res #" + itos(attr_resid);
if (attr_value != 0xFFFFFFFF)
value = string_table[attr_value];
else
value = "Res #" + itos(attr_resid);
String attrname = string_table[attr_name]; String attrname = string_table[attr_name];
String nspace; const String nspace = (attr_nspace != 0xFFFFFFFF) ? string_table[attr_nspace] : "";
if (attr_nspace != 0xFFFFFFFF)
nspace = string_table[attr_nspace];
else
nspace = "";
//replace project information //replace project information
if (tname == "manifest" && attrname == "package") { if (tname == "manifest" && attrname == "package") {
@ -830,14 +822,14 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
// FIXME: `attr_value != 0xFFFFFFFF` below added as a stopgap measure for GH-32553, // FIXME: `attr_value != 0xFFFFFFFF` below added as a stopgap measure for GH-32553,
// but the issue should be debugged further and properly addressed. // but the issue should be debugged further and properly addressed.
if (tname == "meta-data" && attrname == "name" && attr_value != 0xFFFFFFFF && string_table[attr_value] == "xr_mode_metadata_name") { if (tname == "meta-data" && attrname == "name" && value == "xr_mode_metadata_name") {
// Update the meta-data 'android:name' attribute based on the selected XR mode. // Update the meta-data 'android:name' attribute based on the selected XR mode.
if (xr_mode_index == 1 /* XRMode.OVR */) { if (xr_mode_index == 1 /* XRMode.OVR */) {
string_table.write[attr_value] = "com.samsung.android.vr.application.mode"; string_table.write[attr_value] = "com.samsung.android.vr.application.mode";
} }
} }
if (tname == "meta-data" && attrname == "value" && attr_value != 0xFFFFFFFF && string_table[attr_value] == "xr_mode_metadata_value") { if (tname == "meta-data" && attrname == "value" && value == "xr_mode_metadata_value") {
// Update the meta-data 'android:value' attribute based on the selected XR mode. // Update the meta-data 'android:value' attribute based on the selected XR mode.
if (xr_mode_index == 1 /* XRMode.OVR */) { if (xr_mode_index == 1 /* XRMode.OVR */) {
string_table.write[attr_value] = "vr_only"; string_table.write[attr_value] = "vr_only";