Skip to content
This repository has been archived by the owner on Jun 22, 2020. It is now read-only.

Commit

Permalink
Fixed dereferencing a null-pointer in the TransitionCameraOperator
Browse files Browse the repository at this point in the history
  • Loading branch information
Atvaark committed Mar 14, 2015
1 parent 7b462f5 commit aa99cd3
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
using DarkSoulsII.DebugView.Core.DarkSoulsII.Rtti;
using DarkSoulsII.DebugView.Core.Exceptions;

namespace DarkSoulsII.DebugView.Core.DarkSoulsII.Camera.Operators
{
Expand All @@ -18,16 +20,18 @@ public TransitionCameraOperator()
public new TransitionCameraOperator Read(IPointerFactory pointerFactory, IReader reader, int address, bool relative = false)
{
base.Read(pointerFactory, reader, address, relative);
// TODO: Check if there is an initialized flag in this class
var cameraOperatorsPointer = GenericPointer.Create(reader, address + 0x00B4, relative);
if (cameraOperatorsPointer.IsNull)
return this;

// BUG: Invalid pointer during the game initialization states
var cameraOperators = GenericPointer.Create(reader, address + 0x00B4, relative)
var cameraOperators = cameraOperatorsPointer
.Unbox(reader, (r, a) => r.ReadInt32(10, a))
.Select(a => CameraOperatorHelper.Instance.ResolvePointer(pointerFactory, reader, a).Unbox(pointerFactory, reader));
CameraOperators.AddRange(cameraOperators);

var index = reader.ReadInt32(address + 0x00C4, relative);
CurrentOperator = CameraOperators.ElementAt(index);
CurrentOperatorType = (CameraOperatorType) index;
CurrentOperatorType = (CameraOperatorType)index;
int freeze = reader.ReadInt32(address + 0x00C8, relative);
int index2 = reader.ReadInt32(address + 0x00CC, relative);
return this;
Expand Down

0 comments on commit aa99cd3

Please sign in to comment.