diff --git a/docs/notework.txt b/docs/notework.txt index 6a095b6..dd06508 100644 --- a/docs/notework.txt +++ b/docs/notework.txt @@ -12,6 +12,8 @@ ______________________________________________________________________ Notes for GoldED+ 1.1.5, /snapshot/ ______________________________________________________________________ +- Do not crash if problem to access MC clipboard (Linux specific). + - To fix problem with related pathname in NODEPATH the Goldnode will write only filename in .gxl file. Most users should not notice this change at all. diff --git a/goldlib/gall/gutlunix.cpp b/goldlib/gall/gutlunix.cpp index f58a229..a03616c 100644 --- a/goldlib/gall/gutlunix.cpp +++ b/goldlib/gall/gutlunix.cpp @@ -105,14 +105,17 @@ char* g_get_clip_text(void) { std::string clipfile = CLIPFILE; strschg_environ(clipfile); size_t size = GetFilesize(clipfile.c_str()); - char *text = (char *)throw_malloc(size+1); - *text = NUL; - FILE *f = fopen(clipfile.c_str(), "rt"); - if(f != NULL) { - fread(text, 1, size, f); - text[size] = NUL; - fclose(f); + if(size != -1) { + char *text = (char *)throw_malloc(size+1); + *text = NUL; + + FILE *f = fopen(clipfile.c_str(), "rt"); + if(f != NULL) { + fread(text, 1, size, f); + text[size] = NUL; + fclose(f); + } } return text;