mirror of
https://github.com/openharmony/drivers_framework.git
synced 2026-07-20 19:27:49 -04:00
fix: hc-gen segment fault when decompile empty array
Signed-off-by: yuanbo <yuanbo@huawei.com>
This commit is contained in:
@@ -72,15 +72,17 @@ int32_t DecompileGen::PrintArrayType(const std::shared_ptr<AstObject>& astObj)
|
||||
{
|
||||
WriteFile("[");
|
||||
auto arrayElement = astObj->Child();
|
||||
while (arrayElement->Next()) {
|
||||
if (arrayElement != nullptr) {
|
||||
while (arrayElement->Next()) {
|
||||
if (PrintBaseType(arrayElement) != NOERR) {
|
||||
return EOUTPUT;
|
||||
}
|
||||
WriteFile(", ");
|
||||
arrayElement = arrayElement->Next();
|
||||
}
|
||||
if (PrintBaseType(arrayElement) != NOERR) {
|
||||
return EOUTPUT;
|
||||
}
|
||||
WriteFile(", ");
|
||||
arrayElement = arrayElement->Next();
|
||||
}
|
||||
if (PrintBaseType(arrayElement) != NOERR) {
|
||||
return EOUTPUT;
|
||||
}
|
||||
WriteFile("]");
|
||||
return NOERR;
|
||||
|
||||
Reference in New Issue
Block a user