Explorar el Código

Handle empty lines in server history

tags/v1.12.90
Pierre Ossman hace 2 años
padre
commit
1f56a8b0db
Se han modificado 1 ficheros con 8 adiciones y 4 borrados
  1. 8
    4
      vncviewer/ServerDialog.cxx

+ 8
- 4
vncviewer/ServerDialog.cxx Ver fichero

@@ -349,22 +349,26 @@ void ServerDialog::loadServerHistory()
lineNr, filepath, strerror(errno));
}

if (strlen(line) == (sizeof(line) - 1)) {
int len = strlen(line);

if (len == (sizeof(line) - 1)) {
fclose(f);
throw Exception(_("Failed to read line %d in file %s: %s"),
lineNr, filepath, _("Line too long"));
}

int len = strlen(line);
if (line[len-1] == '\n') {
if ((len > 0) && (line[len-1] == '\n')) {
line[len-1] = '\0';
len--;
}
if (line[len-1] == '\r') {
if ((len > 0) && (line[len-1] == '\r')) {
line[len-1] = '\0';
len--;
}

if (len == 0)
continue;

serverHistory.push_back(line);
}


Cargando…
Cancelar
Guardar