[Issue 22359] joiner over an empty forward range object liable to segfault
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Oct 6 01:55:38 UTC 2021
https://issues.dlang.org/show_bug.cgi?id=22359
--- Comment #2 from Adam D. Ruppe <destructionator at gmail.com> ---
A patched function that can fix the issue:
static if (isForwardRange!RoR && isForwardRange!(ElementType!RoR))
{
@property auto save()
{
static if(is(typeof(null) : typeof(_current))) {
auto r = Result(_items.save, _current is null ?
null : _current.save);
} else
auto r = Result(_items.save, _current.save);
static if (isBidirectional)
{
static if(is(typeof(null) :
typeof(_currentBack))) {
r._currentBack = _currentBack is null ?
null : _currentBack.save;
} else {
r._currentBack = _currentBack.save;
}
r.reachedFinalElement = reachedFinalElement;
}
return r;
}
}
--
More information about the Digitalmars-d-bugs
mailing list