mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 22:03:42 -07:00
avoid printing null items
This commit is contained in:
parent
5f9d8273e6
commit
8d5f31757f
1 changed files with 10 additions and 0 deletions
|
@ -1259,6 +1259,11 @@ static bool Unpack_bc40(wiegand_message_t *packed, wiegand_card_t *card) {
|
||||||
|
|
||||||
void print_desc_wiegand(cardformat_t *fmt, wiegand_message_t *packed) {
|
void print_desc_wiegand(cardformat_t *fmt, wiegand_message_t *packed) {
|
||||||
|
|
||||||
|
// return if invalid card format
|
||||||
|
if (fmt->Name == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
char *s = calloc(128, sizeof(uint8_t));
|
char *s = calloc(128, sizeof(uint8_t));
|
||||||
sprintf(s, _YELLOW_("%-10s")" %-32s", fmt->Name, fmt->Descrp);
|
sprintf(s, _YELLOW_("%-10s")" %-32s", fmt->Name, fmt->Descrp);
|
||||||
|
|
||||||
|
@ -1397,6 +1402,11 @@ void HIDListFormats(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
cardformat_t HIDGetCardFormat(int idx) {
|
cardformat_t HIDGetCardFormat(int idx) {
|
||||||
|
|
||||||
|
// if idx is out-of-bounds, return the last item
|
||||||
|
if ((idx < 0) || (idx > ARRAYLEN(FormatTable) - 2)) {
|
||||||
|
return FormatTable[ARRAYLEN(FormatTable) - 1];
|
||||||
|
}
|
||||||
return FormatTable[idx];
|
return FormatTable[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue