From 68033ed776a77b11e831569c93af82fe8b043dc8 Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Sun, 11 Jan 2015 21:49:13 +0100 Subject: [PATCH 1/1] Fixed error when no match is found for uidmapping --- client/cmdhf14a.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/client/cmdhf14a.c b/client/cmdhf14a.c index 53ab240c..01602d76 100644 --- a/client/cmdhf14a.c +++ b/client/cmdhf14a.c @@ -112,20 +112,15 @@ const manufactureName manufactureMapping[] = { // returns description of the best match char* getTagInfo(uint8_t uid) { - int i, best = -1; + int i; int len = sizeof(manufactureMapping) / sizeof(manufactureName); - for ( i = 0; i < len; ++i ) { - if ( uid == manufactureMapping[i].uid) { - if (best == -1) { - best = i; - } - } - } + for ( i = 0; i < len; ++i ) + if ( uid == manufactureMapping[i].uid) + return manufactureMapping[i].desc; - if (best>=0) return manufactureMapping[best].desc; - - return manufactureMapping[i].desc; + //No match, return default + return manufactureMapping[len-1].desc; } int CmdHF14AList(const char *Cmd) -- 2.39.5