network/packet: Fix reading vectors/arrays of strings
Previously would break here, as it is trying to initialize a string with 0, which is then considered NULL.
This commit is contained in:
parent
8b8b39ec0e
commit
94be4050bc
|
@ -126,7 +126,7 @@ Packet& Packet::operator>>(std::vector<T>& out_data) {
|
||||||
|
|
||||||
// Then extract the data
|
// Then extract the data
|
||||||
for (std::size_t i = 0; i < out_data.size(); ++i) {
|
for (std::size_t i = 0; i < out_data.size(); ++i) {
|
||||||
T character = 0;
|
T character;
|
||||||
*this >> character;
|
*this >> character;
|
||||||
out_data[i] = character;
|
out_data[i] = character;
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ Packet& Packet::operator>>(std::vector<T>& out_data) {
|
||||||
template <typename T, std::size_t S>
|
template <typename T, std::size_t S>
|
||||||
Packet& Packet::operator>>(std::array<T, S>& out_data) {
|
Packet& Packet::operator>>(std::array<T, S>& out_data) {
|
||||||
for (std::size_t i = 0; i < out_data.size(); ++i) {
|
for (std::size_t i = 0; i < out_data.size(); ++i) {
|
||||||
T character = 0;
|
T character;
|
||||||
*this >> character;
|
*this >> character;
|
||||||
out_data[i] = character;
|
out_data[i] = character;
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue