lua - nullcheck bizstring.split()

This commit is contained in:
adelikat 2014-05-21 02:05:26 +00:00
parent e88b7cc93e
commit ac6c5e6b48
1 changed files with 9 additions and 6 deletions

View File

@ -144,13 +144,16 @@ namespace BizHawk.Client.Common
public LuaTable Split(string str, string separator)
{
var table = Lua.NewTable();
var splitStr = str.Split(
new char[] { separator.FirstOrDefault() },
StringSplitOptions.RemoveEmptyEntries);
for(int i = 0; i < splitStr.Length; i++)
if (!string.IsNullOrEmpty(str))
{
table[i] = splitStr[i];
var splitStr = str.Split(
new char[] { separator.FirstOrDefault() },
StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < splitStr.Length; i++)
{
table[i] = splitStr[i];
}
}
return table;