Skip to content

Commit

Permalink
Fix warnings in views
Browse files Browse the repository at this point in the history
  • Loading branch information
neilsarkar committed Nov 10, 2020
1 parent 9d84744 commit c46fbe9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Runtime/Views/ChildView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ public abstract class ChildView<TState, T> : View<TState> where TState : class,
/// Index returns this elements index in the parent RepeatView
/// </summary>
/// <returns>int</returns>
protected int Index => index > -1 ? index : index = GetIndex();
public int Index => index > -1 ? index : index = GetIndex();
/// <summary>
/// Item returns the element associated with this ChildView
/// </summary>
/// <returns>T Item</returns>
protected T Item => parent?.Items == null || parent.Items.Count <= Index ? default(T) : parent.Items[Index];
public T Item => parent?.Items == null || parent.Items.Count <= Index ? default(T) : parent.Items[Index];
protected T LastItem => LastState == null || parent?.LastItems == null || parent.LastItems.Count <= Index ? default(T) : parent.LastItems[Index];

protected virtual void Render(T item, int index, TState state) {}
Expand Down
7 changes: 5 additions & 2 deletions Runtime/Views/View.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ void RenderWrapper(TState state, TState lastState) {
}
}

// in builds, ForceRender never gets used
#pragma warning disable CS0649
internal static bool ForceRender;
#pragma warning restore CS0649
void State_OnChange() {
RenderWrapper(State, ForceRender ? default(TState) : LastState);
}
Expand Down Expand Up @@ -155,8 +158,8 @@ protected virtual void EditorUpdate() {
if (Application.isPlaying) { return; }
if (State == null) { Warn("State is null"); return; }
try {
if (gameObject == null);
} catch(MissingReferenceException e) {
if (gameObject == null) {}
} catch(MissingReferenceException) {
EditorApplication.update -= EditorUpdate;
return;
}
Expand Down

0 comments on commit c46fbe9

Please sign in to comment.