1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-19 23:22:16 +03:00

fix sd example returning bad json on empty folder

This commit is contained in:
John Doe 2015-06-09 01:34:59 +03:00
parent 09c88adb18
commit fe562e6785

View File

@ -184,15 +184,14 @@ void printDirectory() {
server.send(200, "text/json", "");
WiFiClient client = server.client();
server.sendContent("[");
for (int cnt = 0; true; ++cnt) {
File entry = dir.openNextFile();
if (!entry)
break;
String output;
if (cnt == 0)
output = '[';
else
if (cnt > 0)
output = ',';
output += "{\"type\":\"";