summaryrefslogtreecommitdiff
path: root/perlio.c
diff options
context:
space:
mode:
Diffstat (limited to 'perlio.c')
-rw-r--r--perlio.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/perlio.c b/perlio.c
index faa3b19369..c4a81afd7c 100644
--- a/perlio.c
+++ b/perlio.c
@@ -2613,8 +2613,10 @@ char *
PerlIOStdio_mode(const char *mode, char *tmode)
{
char *ret = tmode;
- while (*mode) {
- *tmode++ = *mode++;
+ if (mode) {
+ while (*mode) {
+ *tmode++ = *mode++;
+ }
}
#if defined(PERLIO_USING_CRLF) || defined(__CYGWIN__)
*tmode++ = 'b';