null checks

master
Daniel Kolesa 2015-08-06 23:57:40 +01:00
parent 8ba91c12fe
commit 661bd5244e
1 changed files with 2 additions and 2 deletions

View File

@ -42,7 +42,7 @@ public:
template<typename U>
CharRangeBase(U beg, EnableIf<
IsConvertible<U, T *>::value && !IsArray<U>::value, Nat
> = Nat()): p_beg(beg), p_end((T *)beg + strlen(beg)) {}
> = Nat()): p_beg(beg), p_end((T *)beg + (beg ? strlen(beg) : 0)) {}
template<typename U, Size N>
CharRangeBase(U (&beg)[N], EnableIf<
@ -71,7 +71,7 @@ public:
}
/* TODO: traits for utf-16/utf-32 string lengths, for now assume char */
CharRangeBase &operator=(T *s) {
p_beg = s; p_end = s + strlen(s); return *this;
p_beg = s; p_end = s + (s ? strlen(s) : 0); return *this;
}
bool empty() const { return p_beg == p_end; }