Skip to content

Commit 9b3c387

Browse files
ben-schwenaitap
andauthored
add connections guard
Co-authored-by: aitap <[email protected]>
1 parent 1b7cec7 commit 9b3c387

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/freadR.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,9 @@ void progress(int p, int eta)
742742

743743
// Spill connection contents to a tempfile so R-level fread can treat it like a filename
744744
SEXP spillConnectionToFile(SEXP connection, SEXP tempfile_path, SEXP nrows_limit) {
745+
#if R_CONNECTIONS_VERSION != 1
746+
INTERNAL_STOP(_("spillConnectionToFile: unexpected R_CONNECTIONS_VERSION = %d", R_CONNECTIONS_VERSION)); // # nocov
747+
#else
745748
if (!isString(tempfile_path) || LENGTH(tempfile_path) != 1) {
746749
INTERNAL_STOP(_("spillConnectionToFile: tempfile_path must be a single string")); // # nocov
747750
}
@@ -814,6 +817,7 @@ SEXP spillConnectionToFile(SEXP connection, SEXP tempfile_path, SEXP nrows_limit
814817
free(buffer);
815818
fclose(outfile);
816819
return ScalarReal((double)total_read);
820+
#endif // was R_CONNECTIONS_VERSION not != 1?
817821
}
818822

819823
void halt__(bool warn, const char *format, ...)

0 commit comments

Comments
 (0)