Skip to content

Commit

Permalink
Added Null checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent-P committed Aug 31, 2019
1 parent 96dc787 commit ffe9d38
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 5 deletions.
7 changes: 4 additions & 3 deletions Scripts/Libs/smokegun/Items.Script.txt
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ Text CreateLayerItems() {

declare LocalPlayer <=> InputPlayer;
if (GUIPlayer != Null && GUIPlayer != LocalPlayer) LocalPlayer <=> GUIPlayer;
if (LocalPlayer == Null) continue;

declare Index = 1;
declare netread Integer[Text] ItemBuffTimes for LocalPlayer = [];
Expand Down Expand Up @@ -207,11 +208,11 @@ Text CreateLayerItems() {
Ratio = 1.;
}
Gauge_Item.Ratio = Ratio;

declare TimeDiffText = ML::NearestInteger(TimeDiff / 100.) / 10.;
Label_Time.Value = TimeDiffText^"s";
}

declare ItemParts = TL::Split("\\", ItemName);
ItemParts = TL::Split(".", ItemParts[ItemParts.count-1]);
Label_Item.Value = ItemParts[0];
Expand Down Expand Up @@ -245,4 +246,4 @@ Text CreateLayerItems() {
</frame>
</manialink>""";
return Manialink;
}
}
1 change: 1 addition & 0 deletions Scripts/Libs/smokegun/UI/Chrono.Script.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Text GetLayer() {

declare LocalPlayer <=> InputPlayer;
if (GUIPlayer != Null) LocalPlayer <=> GUIPlayer;
if (LocalPlayer == Null) continue;

declare netread Net_UsedJump for LocalPlayer = False;
if (PrevUsedJump != Net_UsedJump) {
Expand Down
1 change: 1 addition & 0 deletions Scripts/Libs/smokegun/UI/CpProgress.Script.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Text GetLayer() {

declare LocalPlayer <=> InputPlayer;
if (GUIPlayer != Null) LocalPlayer <=> GUIPlayer;
if (LocalPlayer == Null) continue;

declare netread Net_CheckpointsTotal for Teams[0] = -1;
declare netread Net_StartTime for LocalPlayer = -1;
Expand Down
1 change: 1 addition & 0 deletions Scripts/Libs/smokegun/UI/Markers.Script.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ main() {

declare LocalPlayer <=> InputPlayer;
if (GUIPlayer != Null) LocalPlayer <=> GUIPlayer;
if (LocalPlayer == Null) continue;

declare netread Integer Net_CpProgress for LocalPlayer;
declare netread Text[] LastCheckpointsIdsStr for LocalPlayer;
Expand Down
1 change: 1 addition & 0 deletions Scripts/Libs/smokegun/UI/NextMapVote.Script.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ Text GetLayer(Real _NextMapVotingRatio) {

declare LocalPlayer <=> InputPlayer;
if (GUIPlayer != Null) LocalPlayer <=> GUIPlayer;
if (LocalPlayer == Null) continue;

// Process events
foreach (Event in PendingEvents) {
Expand Down
3 changes: 2 additions & 1 deletion Scripts/Libs/smokegun/UI/SpecKeys.Script.txt
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ Text GetLayer() {
Void UpdateSpec() {
declare LocalPlayer <=> InputPlayer;
if (GUIPlayer != Null) LocalPlayer <=> GUIPlayer;
if (LocalPlayer == Null) return;

declare netread Keys LastKeys for LocalPlayer;
log("Spec "^LastKeys);
Expand Down Expand Up @@ -217,4 +218,4 @@ Text GetLayer() {
}
--></script>
</manialink>""";
}
}
2 changes: 1 addition & 1 deletion Scripts/Libs/smokegun/UI/SpectatorCount.Script.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Text GetLayer() {

declare LocalPlayer <=> InputPlayer;
if (GUIPlayer != Null) LocalPlayer <=> GUIPlayer;

if (LocalPlayer == Null) continue;

declare netread Net_NbSpectating for LocalPlayer = 0;
if (LastNbSpectating != Net_NbSpectating)
Expand Down
1 change: 1 addition & 0 deletions Scripts/Libs/smokegun/UI/TimeDiff.Script.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Text GetLayer() {

declare LocalPlayer <=> InputPlayer;
if (GUIPlayer != Null) LocalPlayer <=> GUIPlayer;
if (LocalPlayer == Null) continue;

declare netread Net_LayerTimeDiffUpdated for LocalPlayer = 0;
declare netread Net_Time1 for LocalPlayer = 0;
Expand Down
4 changes: 4 additions & 0 deletions Scripts/Modes/ShootMania/Obstacle.Script.txt
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,10 @@ foreach (Event in PendingEvents) {
// Discard the defaut behaviour (e.g Player is eliminated)
Discard(Event);

if (Event.Victim == Null) {
continue;
}

// Dont respawn if the player has the offzone item
if (Event.Victim.IsInOffZone) {
declare ItemBuffs = Player::getBuffTimes(Event.Victim);
Expand Down

0 comments on commit ffe9d38

Please sign in to comment.