mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r10566) -Fix [FS#1025]: a NewGRF could have a information message that is too long for the internal buffers to handle. We should not crash on such a case even though the message is too big for the window anyway.
This commit is contained in:
parent
6ba71707f2
commit
197245eefe
|
@ -9,6 +9,7 @@
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
#include "table/control_codes.h"
|
#include "table/control_codes.h"
|
||||||
#include "helpers.hpp"
|
#include "helpers.hpp"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <ctype.h> // required for tolower()
|
#include <ctype.h> // required for tolower()
|
||||||
|
@ -47,11 +48,14 @@ char* strecpy(char* dst, const char* src, const char* last)
|
||||||
assert(dst <= last);
|
assert(dst <= last);
|
||||||
for (; *src != '\0' && dst != last; ++dst, ++src) *dst = *src;
|
for (; *src != '\0' && dst != last; ++dst, ++src) *dst = *src;
|
||||||
*dst = '\0';
|
*dst = '\0';
|
||||||
#if 1
|
|
||||||
if (dst == last && *src != '\0') {
|
if (dst == last && *src != '\0') {
|
||||||
|
#ifdef STRGEN
|
||||||
error("String too long for destination buffer");
|
error("String too long for destination buffer");
|
||||||
|
#else /* STRGEN */
|
||||||
|
DEBUG(misc, 0, "String too long for destination buffer");
|
||||||
|
*dst = '\0';
|
||||||
|
#endif /* STRGEN */
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return dst;
|
return dst;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue