TextPic.cs edited online with Bitbucket
1. Solved 2 null reference exception, one where inspectorIconList is null at first when you create a TextPic.cs object directly from the menu. And another at GetOutputText() function where sometime count gets higher then m_HrefInfos.Count.pull/413/head
parent
1dc2b604e2
commit
3e580876b1
|
@ -339,7 +339,7 @@ namespace UnityEngine.UI.Extensions {
|
||||||
m_HrefInfos.Add(hrefInfo);
|
m_HrefInfos.Add(hrefInfo);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (m_HrefInfos.Count > 0) {
|
if (count <= m_HrefInfos.Count - 1) {
|
||||||
// Hyperlinks in text starting index
|
// Hyperlinks in text starting index
|
||||||
m_HrefInfos[count].startIndex = (usesNewRendering ? s_TextBuilder.Length : s_TextBuilder.Length * 4);
|
m_HrefInfos[count].startIndex = (usesNewRendering ? s_TextBuilder.Length : s_TextBuilder.Length * 4);
|
||||||
m_HrefInfos[count].endIndex = (usesNewRendering ? (s_TextBuilder.Length + href_matches[i].Groups[2].Length - 1) : (s_TextBuilder.Length + href_matches[i].Groups[2].Length - 1) * 4 + 3);
|
m_HrefInfos[count].endIndex = (usesNewRendering ? (s_TextBuilder.Length + href_matches[i].Groups[2].Length - 1) : (s_TextBuilder.Length + href_matches[i].Groups[2].Length - 1) * 4 + 3);
|
||||||
|
@ -624,9 +624,11 @@ namespace UnityEngine.UI.Extensions {
|
||||||
// Update the quad images
|
// Update the quad images
|
||||||
updateQuad = true;
|
updateQuad = true;
|
||||||
|
|
||||||
for (int i = 0; i < inspectorIconList.Length; i++) {
|
if (inspectorIconList != null) {
|
||||||
if (inspectorIconList[i].scale == Vector2.zero) {
|
for (int i = 0; i < inspectorIconList.Length; i++) {
|
||||||
inspectorIconList[i].scale = Vector2.one;
|
if (inspectorIconList[i].scale == Vector2.zero) {
|
||||||
|
inspectorIconList[i].scale = Vector2.one;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue