diff options
author | Thomas White <taw@physics.org> | 2017-10-26 23:07:15 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2017-10-26 23:07:15 +0200 |
commit | 91ea6184b1eb7aabe2d5cd60f551e1a642201714 (patch) | |
tree | 620a99460c85859c90ce55c6a7c760bfa561dbf2 | |
parent | 2a72c1e0ae7f65c70729cf2a108212cb3db69c8d (diff) |
scblock_delete_text(): Add a warning
-rw-r--r-- | src/sc_parse.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/sc_parse.c b/src/sc_parse.c index 79e59a0..4838bc6 100644 --- a/src/sc_parse.c +++ b/src/sc_parse.c @@ -718,7 +718,15 @@ void sc_insert_block(SCBlock *b1, int o1, SCBlock *ins) void scblock_delete_text(SCBlock *b, size_t o1, size_t o2) { - size_t len = strlen(b->contents); + + size_t len; + + if ( b->contents == NULL ) { + fprintf(stderr, "Deleting text from block \\%s\n", b->name); + return; + } + + len = strlen(b->contents); if ( (o1 >= o2) || (o1 > len) || (o2 > len) ) { fprintf(stderr, "Invalid delete: %i %i %i\n", (int)o1, (int)o2, (int)len); |