<commit_before>﻿using System;
using Windows.Devices.Geolocation;
using Windows.UI.Xaml.Data;
using AugmentedSzczecin.Models;

namespace AugmentedSzczecin.Converters
{
    public class PoiToGeopointConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            PointOfInterest poi = (PointOfInterest)value;
            if (poi.Location.Latitude > -90 && poi.Location.Latitude < 90 && poi.Location.Longitude > -180 && poi.Location.Longitude < 180)
            {
                return new Geopoint(new BasicGeoposition() { Latitude = poi.Location.Latitude, Longitude = poi.Location.Longitude });
            }
            else
                return null;
        }

        public object ConvertBack(object value, Type targetType, object parameter, string language)
        {
            throw new NotImplementedException();
        }
    }
}<commit_msg>Defence coding - check if poi.Location is null<commit_after>﻿using System;
using Windows.Devices.Geolocation;
using Windows.UI.Xaml.Data;
using AugmentedSzczecin.Models;

namespace AugmentedSzczecin.Converters
{
    public class PoiToGeopointConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            PointOfInterest poi = (PointOfInterest)value;
            if (poi.Location != null)
            {
                if (poi.Location.Latitude > -90 && poi.Location.Latitude < 90 && poi.Location.Longitude > -180 &&
                    poi.Location.Longitude < 180 && poi.Location != null)
                {
                    return
                        new Geopoint(new BasicGeoposition()
                        {
                            Latitude = poi.Location.Latitude,
                            Longitude = poi.Location.Longitude
                        });
                }
            }

            return null;
        }

        public object ConvertBack(object value, Type targetType, object parameter, string language)
        {
            throw new NotImplementedException();
        }
    }
}
{'fraction_non_alphanumeric': 0.08089260808926081, 'fraction_numerical': 0.009298000929800094, 'mean_word_length': 1.89247311827957, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6890852', 'n_tokens_mistral': 586, 'n_tokens_neox': 555, 'n_words': 130}