Skip to content

Commit fce0252

Browse files
committed
Fixed decoder
1 parent 87e8495 commit fce0252

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

mapcode.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ int main(const int argc, const char** argv)
5050
if ((strcmp(cmd, "-d") == 0) || (strcmp(cmd, "--decode") == 0)) {
5151

5252
// Decode: [-d | --decode] <default-country-ISO3> <mapcode> [<mapcode> ...]
53-
if (argc < 3) {
53+
if (argc < 4) {
5454
usage(appName);
5555
return -1;
5656
}
@@ -84,8 +84,8 @@ int main(const int argc, const char** argv)
8484
context = text2tc(argv[4], 0);
8585
}
8686
const int nrResults = coord2mc(results, lat, lon, context);
87-
if (nrResults == 0) {
88-
printf("error: cannot encode lat=%s, lon=%s (default country='%s')\n", argv[2], argv[3], (argc == 5) ? argv[4] : "none");
87+
if (nrResults <= 0) {
88+
printf("error: cannot encode lat=%s, lon=%s (default country=%d)\n", argv[2], argv[3], context);
8989
return -1;
9090
}
9191
for (int i = 0; i < nrResults; ++i) {

0 commit comments

Comments
 (0)