1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Fixed a bug when parsing IP address strings

This commit is contained in:
ed 2018-05-17 14:36:28 +01:00
parent 876aaf49e7
commit 6f65cf0f7b

View file

@ -116,15 +116,18 @@ IPAddress::IPAddress (const String& adr)
if (tokens.contains ({})) // if :: shorthand has been used
{
int idx = tokens.indexOf (StringRef());
auto idx = tokens.indexOf ({});
tokens.set (idx, "0");
tokens.removeEmptyStrings();
// mapped IPv4 address will be treated as a single token, so pad the end of the StringArray
if (tokens[tokens.size() - 1].containsChar ('.'))
tokens.add ({});
while (tokens.size() < 8)
tokens.insert (idx, "0");
}
tokens.removeEmptyStrings();
for (int i = 0; i < 8; ++i)
{
if (i == 6 && isIPv4MappedAddress (IPAddress (address, true)))