small refactoring

This commit is contained in:
wargio 2024-01-07 20:04:06 +08:00 committed by Anton Kochkov
parent 4f004a2442
commit 33882a2e15

View File

@ -3188,13 +3188,13 @@ QList<ExportDescription> CutterCore::getAllExports()
QList<SymbolDescription> CutterCore::getAllSymbols() QList<SymbolDescription> CutterCore::getAllSymbols()
{ {
CORE_LOCK(); CORE_LOCK();
QList<SymbolDescription> ret; RzBinFile *bf = rz_bin_cur(core->bin);
if (!bf) {
if (!(core && core->bin && core->bin->cur && core->bin->cur->o)) {
return {}; return {};
} }
const RzPVector *symbols = rz_bin_object_get_symbols(core->bin->cur->o); QList<SymbolDescription> ret;
const RzPVector *symbols = rz_bin_object_get_symbols(bf->o);
if (symbols) { if (symbols) {
for (const auto &bs : CutterPVector<RzBinSymbol>(symbols)) { for (const auto &bs : CutterPVector<RzBinSymbol>(symbols)) {
QString type = QString(bs->bind) + " " + QString(bs->type); QString type = QString(bs->bind) + " " + QString(bs->type);
@ -3207,7 +3207,7 @@ QList<SymbolDescription> CutterCore::getAllSymbols()
} }
} }
const RzList *entries = rz_bin_object_get_entries(core->bin->cur->o); const RzList *entries = rz_bin_object_get_entries(bf->o);
if (entries) { if (entries) {
/* list entrypoints as symbols too */ /* list entrypoints as symbols too */
int n = 0; int n = 0;