diff options
Diffstat (limited to 'sfntly/data/readable_font_data.cc')
-rw-r--r-- | sfntly/data/readable_font_data.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sfntly/data/readable_font_data.cc b/sfntly/data/readable_font_data.cc index bb58c26..06d783f 100644 --- a/sfntly/data/readable_font_data.cc +++ b/sfntly/data/readable_font_data.cc @@ -257,21 +257,25 @@ int32_t ReadableFontData::SearchULong(int32_t start_index, CALLER_ATTACH FontData* ReadableFontData::Slice(int32_t offset, int32_t length) { if (offset < 0 || offset + length > Size()) { +#if !defined (SFNTLY_NO_EXCEPTION) + throw IndexOutOfBoundsException( + "Attempt to bind data outside of its limits"); +#endif return NULL; } FontDataPtr slice = new ReadableFontData(this, offset, length); - // Note: exception not ported because the condition is always false in C++. - // if (slice == null) { throw new IndexOutOfBoundsException( ... return slice.Detach(); } CALLER_ATTACH FontData* ReadableFontData::Slice(int32_t offset) { if (offset < 0 || offset > Size()) { +#if !defined (SFNTLY_NO_EXCEPTION) + throw IndexOutOfBoundsException( + "Attempt to bind data outside of its limits"); +#endif return NULL; } FontDataPtr slice = new ReadableFontData(this, offset); - // Note: exception not ported because the condition is always false in C++. - // if (slice == null) { throw new IndexOutOfBoundsException( ... return slice.Detach(); } |